diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index b9c38cec84..2dc77a3645 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -855,13 +855,16 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo SHAPE_POLY_SET polyList = SHAPE_POLY_SET( aZoneContainer->GetFilledPolysList(), true ); // This convert the poly in outline and holes - Convert_shape_line_polygon_to_triangles( polyList, - *aDstContainer, - m_biuTo3Dunits, + Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aZoneContainer ); // add filled areas outlines, which are drawn with thick lines segments - // ///////////////////////////////////////////////////////////////////////// + // but only if filled polygons outlines have thickness + if( !aZoneContainer->GetFilledPolysUseThickness() ) + return; + + float line_thickness = aZoneContainer->GetMinThickness() * m_biuTo3Dunits; + for( int i = 0; i < polyList.OutlineCount(); ++i ) { // Add outline @@ -877,17 +880,15 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo if( Is_segment_a_circle( start3DU, end3DU ) ) { - float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits; + float radius = line_thickness/2; if( radius > 0.0 ) // degenerated circles crash 3D viewer - aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, radius , + aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, radius, *aZoneContainer ) ); } else { - aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, end3DU, - aZoneContainer->GetMinThickness() * - m_biuTo3Dunits, + aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, end3DU, line_thickness, *aZoneContainer ) ); } } @@ -907,7 +908,7 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo if( Is_segment_a_circle( start3DU, end3DU ) ) { - float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits; + float radius = line_thickness/2; if( radius > 0.0 ) // degenerated circles crash 3D viewer aDstContainer->Add( @@ -917,9 +918,7 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo else { aDstContainer->Add( - new CROUNDSEGMENT2D( start3DU, end3DU, - aZoneContainer->GetMinThickness() * - m_biuTo3Dunits, + new CROUNDSEGMENT2D( start3DU, end3DU, line_thickness, *aZoneContainer ) ); } } diff --git a/include/board_design_settings.h b/include/board_design_settings.h index b16111b70f..9894f21f58 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.txt for contributors. + * Copyright (C) 2009-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -198,6 +198,14 @@ public: int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter int m_CopperEdgeClearance; + /** Option to handle filled polygons in zones: + * the "legacy" option is using thick outlines around filled polygons: give the best shape + * the "new" option is using only filled polygons (no outline: give the faster redraw time + * moreover when exporting zone filled areas, the excatct shape is exported. + * the legacy option can really create redraw time issues for large boards. + */ + bool m_ZoneUseNoOutlineInFill; // true for new filling option + // Maximum error allowed when approximating circles and arcs to segments int m_MaxError; diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index ca969e29b9..2875758575 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -497,6 +497,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : m_CopperEdgeClearance = Millimeter2iu( DEFAULT_COPPEREDGECLEARANCE ); m_MaxError = ARC_HIGH_DEF; + m_ZoneUseNoOutlineInFill = false; // Use compatibility mode by default // Global mask margins: m_SolderMaskMargin = Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ); diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 340c2e406f..a925e8656f 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -66,6 +66,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : m_cornerRadius = 0; SetLocalFlags( 0 ); // flags tempoarry used in zone calculations m_Poly = new SHAPE_POLY_SET(); // Outlines + m_FilledPolysUseThickness = true; // set the "old" way to build filled polygon areas (before 6.0.x) aBoard->GetZoneSettings().ExportSetting( *this ); m_needRefill = false; // True only after some edition. @@ -84,6 +85,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : m_IsFilled = aZone.m_IsFilled; m_ZoneClearance = aZone.m_ZoneClearance; // clearance value m_ZoneMinThickness = aZone.m_ZoneMinThickness; + m_FilledPolysUseThickness = aZone.m_FilledPolysUseThickness; m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons) m_hv45 = aZone.m_hv45; m_priority = aZone.m_priority; @@ -123,6 +125,7 @@ ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther ) m_CornerSelection = nullptr; // for corner moving, corner index to (null if no selection) m_ZoneClearance = aOther.m_ZoneClearance; // clearance value m_ZoneMinThickness = aOther.m_ZoneMinThickness; + m_FilledPolysUseThickness = aOther.m_FilledPolysUseThickness; m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons) m_PadConnection = aOther.m_PadConnection; m_ThermalReliefGap = aOther.m_ThermalReliefGap; @@ -428,10 +431,11 @@ void ZONE_CONTAINER::PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wx CornersBuffer.push_back( p0 ); // Draw outlines: - if( ( m_ZoneMinThickness > 1 ) || outline_mode ) + int outline_thickness = GetFilledPolysUseThickness() ? GetMinThickness() : 0; + + if( ( outline_thickness > 1 ) || outline_mode ) { int ilim = CornersBuffer.size() - 1; - int line_thickness = m_ZoneMinThickness; for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ ) { @@ -439,12 +443,12 @@ void ZONE_CONTAINER::PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wx if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) { GRCSegm( nullptr, DC, CornersBuffer[is], CornersBuffer[ie], - line_thickness, color ); + outline_thickness, color ); } else { GRFilledSegment( nullptr, DC, CornersBuffer[is], CornersBuffer[ie], - line_thickness, color ); + outline_thickness, color ); } } } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index f69c234022..b900afddff 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,7 +24,6 @@ /** * @file class_zone.h - * @brief Classes to handle copper zones */ #ifndef CLASS_ZONE_H_ @@ -423,8 +422,6 @@ public: /** Access to m_Poly parameters */ - - int GetNumCorners( void ) const { return m_Poly->TotalVertices(); @@ -585,11 +582,15 @@ public: void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; }; - int GetCornerSmoothingType() const { return m_cornerSmoothingType; }; + int GetCornerSmoothingType() const { return m_cornerSmoothingType; } void SetCornerRadius( unsigned int aRadius ); - unsigned int GetCornerRadius() const { return m_cornerRadius; }; + unsigned int GetCornerRadius() const { return m_cornerRadius; } + + bool GetFilledPolysUseThickness() const { return m_FilledPolysUseThickness; } + void SetFilledPolysUseThickness( bool aWidth ) { m_FilledPolysUseThickness = aWidth; } + /** * add a polygon to the zone outline @@ -729,6 +730,7 @@ private: ZoneConnection m_PadConnection; int m_ZoneClearance; ///< Clearance value in internal units. int m_ZoneMinThickness; ///< Minimum thickness value in filled areas. + bool m_FilledPolysUseThickness; ///< outline of filled polygons have thickness. /** True when a zone was filled, false after deleting the filled areas. */ bool m_IsFilled; diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.cpp b/pcbnew/dialogs/panel_setup_feature_constraints.cpp index 2564b7dbfc..79188c856a 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,6 +28,8 @@ #include +#include // To be removed later, when the zone fill option will be always allowed + PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) : @@ -43,6 +45,10 @@ PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* { m_Frame = aFrame; m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings(); + + // Temporary option: allows zone fill option only if the advanced config option allow it + if( ADVANCED_CFG::GetCfg().m_forceThickOutlinesInZones ) + m_bSizerPolygonFillOption->Show( false ); } @@ -67,6 +73,9 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow() m_maxError.SetValue( m_BrdSettings->m_MaxError ); + m_cbOutlinePolygonFastest->SetValue( m_BrdSettings->m_ZoneUseNoOutlineInFill ); + m_cbOutlinePolygonBestQ->SetValue( !m_BrdSettings->m_ZoneUseNoOutlineInFill ); + return true; } @@ -97,6 +106,8 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow() m_BrdSettings->m_MaxError = Clamp( IU_PER_MM * MINIMUM_ERROR_SIZE_MM, m_maxError.GetValue(), IU_PER_MM * MAXIMUM_ERROR_SIZE_MM ); + m_BrdSettings->m_ZoneUseNoOutlineInFill = m_cbOutlinePolygonFastest->GetValue(); + return true; } @@ -110,3 +121,14 @@ void PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom( BOARD* aBoard ) m_BrdSettings = savedSettings; } + + +void PANEL_SETUP_FEATURE_CONSTRAINTS::onChangeOutlineOpt( wxCommandEvent& event ) +{ + wxObject* item =event.GetEventObject(); + + if( item == m_cbOutlinePolygonBestQ ) + m_cbOutlinePolygonFastest->SetValue( not m_cbOutlinePolygonBestQ->GetValue() ); + else + m_cbOutlinePolygonBestQ->SetValue( not m_cbOutlinePolygonFastest->GetValue() ); +} diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.h b/pcbnew/dialogs/panel_setup_feature_constraints.h index 40ce36e42f..912a47fd63 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.h +++ b/pcbnew/dialogs/panel_setup_feature_constraints.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -54,10 +54,13 @@ public: PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); ~PANEL_SETUP_FEATURE_CONSTRAINTS( ) override { }; + void ImportSettingsFrom( BOARD* aBoard ); + +private: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; - void ImportSettingsFrom( BOARD* aBoard ); + void onChangeOutlineOpt( wxCommandEvent& event ) override; }; #endif //PANEL_SETUP_FEATURE_CONSTRAINTS_H diff --git a/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp b/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp index 2b717c4c61..1ec9d3db1e 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 23 2019) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -18,48 +18,94 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi sbFeatureRules = new wxBoxSizer( wxVERTICAL ); m_OptAllowBlindBuriedVias = new wxCheckBox( this, wxID_ANY, _("Allow blind/buried vias"), wxDefaultPosition, wxDefaultSize, 0 ); - sbFeatureRules->Add( m_OptAllowBlindBuriedVias, 0, wxRIGHT|wxTOP, 5 ); + sbFeatureRules->Add( m_OptAllowBlindBuriedVias, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptAllowMicroVias = new wxCheckBox( this, wxID_ANY, _("Allow micro vias (uVias)"), wxDefaultPosition, wxDefaultSize, 0 ); - sbFeatureRules->Add( m_OptAllowMicroVias, 0, wxRIGHT|wxTOP, 5 ); + sbFeatureRules->Add( m_OptAllowMicroVias, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); sbFeatureRules->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_OptRequireCourtyards = new wxCheckBox( this, wxID_ANY, _("Require courtyard definitions in footprints"), wxDefaultPosition, wxDefaultSize, 0 ); - sbFeatureRules->Add( m_OptRequireCourtyards, 0, wxTOP|wxRIGHT, 5 ); + sbFeatureRules->Add( m_OptRequireCourtyards, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptOverlappingCourtyards = new wxCheckBox( this, wxID_ANY, _("Prohibit overlapping courtyards"), wxDefaultPosition, wxDefaultSize, 0 ); - sbFeatureRules->Add( m_OptOverlappingCourtyards, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + sbFeatureRules->Add( m_OptOverlappingCourtyards, 0, wxALL, 5 ); sbFeatureRules->Add( 0, 0, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + wxBoxSizer* bSizerArcToPoly; + bSizerArcToPoly = new wxBoxSizer( wxVERTICAL ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerArcToPoly->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + m_stCircleToPolyOpt = new wxStaticText( this, wxID_ANY, _("Arc to polygon approximation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stCircleToPolyOpt->Wrap( -1 ); + m_stCircleToPolyOpt->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + + bSizerArcToPoly->Add( m_stCircleToPolyOpt, 0, wxALL, 5 ); + wxFlexGridSizer* fgSizer2; - fgSizer2 = new wxFlexGridSizer( 0, 3, 3, 0 ); - fgSizer2->AddGrowableCol( 1 ); + fgSizer2 = new wxFlexGridSizer( 0, 4, 3, 0 ); + fgSizer2->AddGrowableCol( 2 ); fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_maxErrorTitle = new wxStaticText( this, wxID_ANY, _("Maximum Error Dist:"), wxDefaultPosition, wxDefaultSize, 0 ); + + fgSizer2->Add( 15, 0, 1, wxEXPAND, 5 ); + + m_maxErrorTitle = new wxStaticText( this, wxID_ANY, _("Maximum error:"), wxDefaultPosition, wxDefaultSize, 0 ); m_maxErrorTitle->Wrap( -1 ); - fgSizer2->Add( m_maxErrorTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM, 5 ); + m_maxErrorTitle->SetToolTip( _("This is the maximum distance between a circle and the polygonal shape that approximate it.\nThe error max defines the number of segments of this polygon.") ); + + fgSizer2->Add( m_maxErrorTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 5 ); m_maxErrorCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer2->Add( m_maxErrorCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); m_maxErrorUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_maxErrorUnits->Wrap( -1 ); - fgSizer2->Add( m_maxErrorUnits, 0, wxALL, 5 ); + fgSizer2->Add( m_maxErrorUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - sbFeatureRules->Add( fgSizer2, 1, wxEXPAND, 5 ); + bSizerArcToPoly->Add( fgSizer2, 0, wxEXPAND, 5 ); + + + sbFeatureRules->Add( bSizerArcToPoly, 0, wxEXPAND, 5 ); + + m_bSizerPolygonFillOption = new wxBoxSizer( wxVERTICAL ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_bSizerPolygonFillOption->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_stZoneFilledPolysOpt = new wxStaticText( this, wxID_ANY, _(" Option to fill polygons in zones:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stZoneFilledPolysOpt->Wrap( -1 ); + m_stZoneFilledPolysOpt->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + + m_bSizerPolygonFillOption->Add( m_stZoneFilledPolysOpt, 0, wxALL, 5 ); + + wxBoxSizer* bSizer5; + bSizer5 = new wxBoxSizer( wxVERTICAL ); + + m_cbOutlinePolygonBestQ = new wxCheckBox( this, wxID_ANY, _("Thick outlines (best quality)"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer5->Add( m_cbOutlinePolygonBestQ, 0, wxALL, 5 ); + + m_cbOutlinePolygonFastest = new wxCheckBox( this, wxID_ANY, _("No outline (fastest draw mode)"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer5->Add( m_cbOutlinePolygonFastest, 0, wxALL, 5 ); + + + m_bSizerPolygonFillOption->Add( bSizer5, 1, wxEXPAND|wxLEFT, 15 ); + + + sbFeatureRules->Add( m_bSizerPolygonFillOption, 0, wxEXPAND, 5 ); bMainSizer->Add( sbFeatureRules, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 25 ); + bMainSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 15 ); wxBoxSizer* sbFeatureConstraints; sbFeatureConstraints = new wxBoxSizer( wxVERTICAL ); @@ -195,8 +241,16 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); + + // Connect Events + m_cbOutlinePolygonBestQ->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this ); + m_cbOutlinePolygonFastest->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this ); } PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::~PANEL_SETUP_FEATURE_CONSTRAINTS_BASE() { + // Disconnect Events + m_cbOutlinePolygonBestQ->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this ); + m_cbOutlinePolygonFastest->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::onChangeOutlineOpt ), NULL, this ); + } diff --git a/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp b/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp index 90be62dc97..8518e70ff2 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp +++ b/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp @@ -14,7 +14,6 @@ panel_setup_feature_constraints_base 1000 none - 1 panel_setup_feature_constraints_base @@ -26,7 +25,6 @@ 1 1 UI - 0 1 0 @@ -67,7 +65,7 @@ none 5 - wxRIGHT|wxTOP + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -131,7 +129,7 @@ 5 - wxRIGHT|wxTOP + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -205,7 +203,7 @@ 5 - wxTOP|wxRIGHT + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -269,7 +267,7 @@ 5 - wxTOP|wxBOTTOM|wxRIGHT + wxALL 0 1 @@ -344,85 +342,17 @@ 5 wxEXPAND - 1 - - 3 - wxBOTH - 1 - - 0 + 0 + - fgSizer2 - wxFLEX_GROWMODE_SPECIFIED + bSizerArcToPoly + wxVERTICAL none - 0 - 3 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM + wxEXPAND | wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Maximum Error Dist: - 0 - - 0 - - - 0 - - 1 - m_maxErrorTitle - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND|wxLEFT|wxRIGHT - 0 - + 1 1 1 @@ -453,12 +383,11 @@ 0 - 0 1 - m_maxErrorCtrl + m_staticline2 1 @@ -468,15 +397,10 @@ Resizable 1 - + wxLI_HORIZONTAL ; ; forward_declare 0 - wxString - wxFILTER_NUMERIC - wxTextValidator - - @@ -510,11 +434,11 @@ 1 1 - + ,90,92,-1,70,0 0 0 wxID_ANY - mm + Arc to polygon approximation: 0 0 @@ -523,7 +447,7 @@ 0 1 - m_maxErrorUnits + m_stCircleToPolyOpt 1 @@ -543,12 +467,497 @@ -1 + + 5 + wxEXPAND + 0 + + 4 + wxBOTH + 2 + + 0 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 3 + + 5 + wxEXPAND + 1 + + 0 + protected + 15 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Maximum error: + 0 + + 0 + + + 0 + + 1 + m_maxErrorTitle + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + This is the maximum distance between a circle and the polygonal shape that approximate it. The error max defines the number of segments of this polygon. + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_maxErrorCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + wxString + wxFILTER_NUMERIC + wxTextValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mm + 0 + + 0 + + + 0 + + 1 + m_maxErrorUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + 5 + wxEXPAND + 0 + + + m_bSizerPolygonFillOption + wxVERTICAL + protected + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + Option to fill polygons in zones: + 0 + + 0 + + + 0 + + 1 + m_stZoneFilledPolysOpt + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 15 + wxEXPAND|wxLEFT + 1 + + + bSizer5 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thick outlines (best quality) + + 0 + + + 0 + + 1 + m_cbOutlinePolygonBestQ + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onChangeOutlineOpt + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + No outline (fastest draw mode) + + 0 + + + 0 + + 1 + m_cbOutlinePolygonFastest + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onChangeOutlineOpt + + + + - 25 + 15 wxEXPAND|wxRIGHT|wxLEFT 0 diff --git a/pcbnew/dialogs/panel_setup_feature_constraints_base.h b/pcbnew/dialogs/panel_setup_feature_constraints_base.h index 8d4999fb52..008c496482 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints_base.h +++ b/pcbnew/dialogs/panel_setup_feature_constraints_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 23 2019) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -36,9 +37,16 @@ class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE : public wxPanel wxCheckBox* m_OptAllowMicroVias; wxCheckBox* m_OptRequireCourtyards; wxCheckBox* m_OptOverlappingCourtyards; + wxStaticLine* m_staticline2; + wxStaticText* m_stCircleToPolyOpt; wxStaticText* m_maxErrorTitle; wxTextCtrl* m_maxErrorCtrl; wxStaticText* m_maxErrorUnits; + wxBoxSizer* m_bSizerPolygonFillOption; + wxStaticLine* m_staticline1; + wxStaticText* m_stZoneFilledPolysOpt; + wxCheckBox* m_cbOutlinePolygonBestQ; + wxCheckBox* m_cbOutlinePolygonFastest; wxStaticText* m_TrackMinWidthTitle; wxTextCtrl* m_TrackMinWidthCtrl; wxStaticText* m_TrackMinWidthUnits; @@ -61,6 +69,10 @@ class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE : public wxPanel wxTextCtrl* m_EdgeClearanceCtrl; wxStaticText* m_EdgeClearanceUnits; + // Virtual event handlers, overide them in your derived class + virtual void onChangeOutlineOpt( wxCommandEvent& event ) { event.Skip(); } + + public: PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 0b1201ef4d..ba9b1eeb6a 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -45,6 +45,7 @@ #include #include + using namespace KIGFX; PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS() @@ -514,7 +515,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer ) break; default: - assert( false ); + wxASSERT( false ); break; } @@ -1162,14 +1163,15 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone, int aLayer ) return; // Set up drawing options + int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0; m_gal->SetStrokeColor( color ); m_gal->SetFillColor( color ); - m_gal->SetLineWidth( aZone->GetMinThickness() ); + m_gal->SetLineWidth( outline_thickness ); if( displayMode == PCB_RENDER_SETTINGS::DZ_SHOW_FILLED ) { m_gal->SetIsFill( true ); - m_gal->SetIsStroke( true ); + m_gal->SetIsStroke( outline_thickness > 0 ); } else if( displayMode == PCB_RENDER_SETTINGS::DZ_SHOW_OUTLINED ) { diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 058fc09927..30daecd9bf 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -612,10 +612,9 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) } -/* Plot areas (given by .m_FilledPolysList member) in a zone - */ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) { + //Plot areas (given by .m_FilledPolysList member) in a zone const SHAPE_POLY_SET& polysList = aZone->GetFilledPolysList(); if( polysList.IsEmpty() ) @@ -650,7 +649,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) /* 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 - * OR a set of segments ) and plot the thick outline itself + * OR a set of segments ) 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 */ @@ -666,18 +666,20 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) cornerList.push_back( cornerList[0] ); // Plot the current filled area and its outline + int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0; + if( GetPlotMode() == FILLED ) { - m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness(), &gbr_metadata ); + m_plotter->PlotPoly( cornerList, FILLED_SHAPE, outline_thickness, &gbr_metadata ); } else { - if( aZone->GetMinThickness() > 0 ) + if( outline_thickness ) { for( unsigned jj = 1; jj < cornerList.size(); jj++ ) { m_plotter->ThickSegment( cornerList[jj -1], cornerList[jj], - aZone->GetMinThickness(), + outline_thickness, GetPlotMode(), &gbr_metadata ); } }