From 3deaf902bb9cde2a432fa287fa75f2f4abc11a65 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Feb 2022 12:42:09 +0000 Subject: [PATCH] Retire the V5 zone fill algorithm. Fixes https://gitlab.com/kicad/code/kicad/issues/10578 --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 55 ----- include/board_design_settings.h | 15 -- pcbnew/board.cpp | 1 - pcbnew/board_design_settings.cpp | 17 +- pcbnew/connectivity/connectivity_algo.cpp | 13 +- pcbnew/connectivity/connectivity_items.h | 8 +- pcbnew/dialogs/panel_setup_constraints.cpp | 15 -- pcbnew/dialogs/panel_setup_constraints.h | 2 - .../dialogs/panel_setup_constraints_base.cpp | 36 +-- .../dialogs/panel_setup_constraints_base.fbp | 212 +----------------- pcbnew/dialogs/panel_setup_constraints_base.h | 8 - .../drc/drc_test_provider_library_parity.cpp | 1 - pcbnew/pcb_painter.cpp | 10 +- pcbnew/plot_brditems_plotter.cpp | 52 +---- pcbnew/plugins/altium/altium_pcb.cpp | 22 +- .../cadstar/cadstar_pcb_archive_loader.cpp | 2 - pcbnew/plugins/kicad/pcb_parser.cpp | 64 ++++-- pcbnew/plugins/kicad/pcb_parser.h | 3 +- pcbnew/plugins/kicad/pcb_plugin.cpp | 6 +- pcbnew/plugins/kicad/pcb_plugin.h | 3 +- pcbnew/plugins/legacy/legacy_plugin.cpp | 8 +- pcbnew/plugins/legacy/legacy_plugin.h | 2 +- pcbnew/zone.cpp | 37 +-- pcbnew/zone.h | 6 - pcbnew/zone_filler.cpp | 29 +-- qa/pcbnew/board_test_utils.cpp | 4 +- qa/pcbnew/board_test_utils.h | 2 +- qa/pcbnew/drc/test_custom_rule_severities.cpp | 2 +- qa/pcbnew/drc/test_drc_regressions.cpp | 4 +- qa/pcbnew/drc/test_solder_mask_bridging.cpp | 2 +- qa/pcbnew/test_tracks_cleaner.cpp | 4 +- qa/pcbnew/test_zone_filler.cpp | 63 +++--- 32 files changed, 120 insertions(+), 588 deletions(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index dcdb71f770..781188de03 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -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 ) ); - } - } - } - } } diff --git a/include/board_design_settings.h b/include/board_design_settings.h index fd9240c759..50b7a87822 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -700,21 +700,6 @@ public: std::map m_DRCSeverities; // Map from DRCErrorCode to SEVERITY std::set 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. diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index da5224929d..183e098698 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -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(); diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 2d5bf0697f..570273a1dc 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -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( "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( "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; diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index c5b8292ced..c737954566 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -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( 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 ); diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index 8b801427dd..79845d14a4 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -316,13 +316,7 @@ public: bool ContainsPoint( const VECTOR2I& p, int aAccuracy = 0 ) const { - ZONE* zone = static_cast( 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() diff --git a/pcbnew/dialogs/panel_setup_constraints.cpp b/pcbnew/dialogs/panel_setup_constraints.cpp index 898bdcaf35..d37ee0a3fa 100644 --- a/pcbnew/dialogs/panel_setup_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_constraints.cpp @@ -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() ); -} diff --git a/pcbnew/dialogs/panel_setup_constraints.h b/pcbnew/dialogs/panel_setup_constraints.h index 8c07666539..48136d7ecc 100644 --- a/pcbnew/dialogs/panel_setup_constraints.h +++ b/pcbnew/dialogs/panel_setup_constraints.h @@ -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; diff --git a/pcbnew/dialogs/panel_setup_constraints_base.cpp b/pcbnew/dialogs/panel_setup_constraints_base.cpp index 468f9ef4c5..cd99e59254 100644 --- a/pcbnew/dialogs/panel_setup_constraints_base.cpp +++ b/pcbnew/dialogs/panel_setup_constraints_base.cpp @@ -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 ); - } diff --git a/pcbnew/dialogs/panel_setup_constraints_base.fbp b/pcbnew/dialogs/panel_setup_constraints_base.fbp index bf9aae42da..64de4cf65a 100644 --- a/pcbnew/dialogs/panel_setup_constraints_base.fbp +++ b/pcbnew/dialogs/panel_setup_constraints_base.fbp @@ -922,7 +922,7 @@ 5 - wxALL + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -981,216 +981,6 @@ -1 - - 15 - wxEXPAND - 0 - - - bSizer5 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bitmapZoneFillOpt - 1 - - - protected - 1 - - Resizable - 1 - - ; ; forward_declare - 0 - - - - - - - - 5 - wxEXPAND - 1 - - - bSizerOutlinesOpts - wxVERTICAL - none - - 4 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Mimic legacy behavior - - 0 - - - 0 - - 1 - m_rbOutlinePolygonBestQ - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Produces a slightly smoother outline at the expense of performance, some export fidelity issues, and overly aggressive higher-priority zone knockouts. - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - onChangeOutlineOpt - - - - 4 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Smoothed polygons (best performance) - - 0 - - - 0 - - 1 - m_rbOutlinePolygonFastest - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Better performance, exact export fidelity, and more complete filling near higher-priority zones. - - wxFILTER_NONE - wxDefaultValidator - - 1 - - - - onChangeOutlineOpt - - - - - - 7 wxEXPAND|wxTOP diff --git a/pcbnew/dialogs/panel_setup_constraints_base.h b/pcbnew/dialogs/panel_setup_constraints_base.h index 33187723b5..af53eed9e4 100644 --- a/pcbnew/dialogs/panel_setup_constraints_base.h +++ b/pcbnew/dialogs/panel_setup_constraints_base.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -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; diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index eab9459ca6..4eadbe11a0 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -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() ); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 0c8287147f..d7d7645eec 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -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 { diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index f16ef5e019..f48b35c85f 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -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( 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 ); } } diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 4cf9225265..d570d59593 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -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& 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 ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 79523b91c5..b4525ea5a5 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -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 ); } } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index f7ca172760..a6663c0600 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -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 ); diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 6cbab5f5f4..89f9ab1c62 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -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 diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 4a64e4a970..5201ba63f0 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -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" ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index fa6d800f30..5c5f3536cf 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -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 diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index fee3d64aa6..acbd862d1b 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -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. diff --git a/pcbnew/plugins/legacy/legacy_plugin.h b/pcbnew/plugins/legacy/legacy_plugin.h index 06297b46a5..e71794d882 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.h +++ b/pcbnew/plugins/legacy/legacy_plugin.h @@ -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 m_netCodes; ///< net codes mapping for boards being loaded diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 1a6458e3cf..a92464c256 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -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 ) ); } diff --git a/pcbnew/zone.h b/pcbnew/zone.h index 3d05bd41d4..fe11513c63 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -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. * diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 25e3aa9b40..ff5d1c7ac4 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -165,8 +165,6 @@ bool ZONE_FILLER::Fill( std::vector& 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; diff --git a/qa/pcbnew/board_test_utils.cpp b/qa/pcbnew/board_test_utils.cpp index e2d117a15e..60df38e80f 100644 --- a/qa/pcbnew/board_test_utils.cpp +++ b/qa/pcbnew/board_test_utils.cpp @@ -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 toFill; - m_board->GetDesignSettings().m_ZoneFillVersion = aFillVersion; - for( ZONE* zone : m_board->Zones() ) toFill.push_back( zone ); diff --git a/qa/pcbnew/board_test_utils.h b/qa/pcbnew/board_test_utils.h index f7906ccead..f977466240 100644 --- a/qa/pcbnew/board_test_utils.h +++ b/qa/pcbnew/board_test_utils.h @@ -61,7 +61,7 @@ public: void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath, std::unique_ptr& aBoard ); -void FillZones( BOARD* m_board, int aFillVersion ); +void FillZones( BOARD* m_board ); } // namespace KI_TEST diff --git a/qa/pcbnew/drc/test_custom_rule_severities.cpp b/qa/pcbnew/drc/test_custom_rule_severities.cpp index c2ca4c9daf..cbace4934e 100644 --- a/qa/pcbnew/drc/test_custom_rule_severities.cpp +++ b/qa/pcbnew/drc/test_custom_rule_severities.cpp @@ -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 violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); diff --git a/qa/pcbnew/drc/test_drc_regressions.cpp b/qa/pcbnew/drc/test_drc_regressions.cpp index ed7e3c2582..a4f49646a6 100644 --- a/qa/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/pcbnew/drc/test_drc_regressions.cpp @@ -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 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& 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 violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); diff --git a/qa/pcbnew/drc/test_solder_mask_bridging.cpp b/qa/pcbnew/drc/test_solder_mask_bridging.cpp index 0dfd38ea95..f05c1f4a16 100644 --- a/qa/pcbnew/drc/test_solder_mask_bridging.cpp +++ b/qa/pcbnew/drc/test_solder_mask_bridging.cpp @@ -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 violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); diff --git a/qa/pcbnew/test_tracks_cleaner.cpp b/qa/pcbnew/test_tracks_cleaner.cpp index 2d44140bd0..19e0168a22 100644 --- a/qa/pcbnew/test_tracks_cleaner.cpp +++ b/qa/pcbnew/test_tracks_cleaner.cpp @@ -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; diff --git a/qa/pcbnew/test_zone_filler.cpp b/qa/pcbnew/test_zone_filler.cpp index b2fd69beb9..c17659637c 100644 --- a/qa/pcbnew/test_zone_filler.cpp +++ b/qa/pcbnew/test_zone_filler.cpp @@ -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 violations; + std::vector violations; - bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& 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 itemMap; - m_board->FillItemMap( itemMap ); - - for( const DRC_ITEM& item : violations ) + bds.m_DRCEngine->SetViolationHandler( + [&]( const std::shared_ptr& 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 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 ) ); } } }