Pcbnew: add refill zone option to DRC.

Make refilling zones during DRC optional to prevent the board from being
changed by changes in the polygon filling.  Default to off to prevent
changes by default.

Fixes lp:1721547

https://bugs.launchpad.net/kicad/+bug/1721547
This commit is contained in:
Wayne Stambaugh 2018-02-10 15:17:11 -05:00
parent b4a17808b0
commit 5ef0b6b67e
6 changed files with 193 additions and 96 deletions

View File

@ -46,6 +46,7 @@
// Keywords for read and write config
#define TestMissingCourtyardKey wxT( "TestMissingCourtyard" )
#define TestFootprintCourtyardKey wxT( "TestFootprintCourtyard" )
#define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame,
@ -68,6 +69,8 @@ DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
{
m_config->Write( TestMissingCourtyardKey, m_cbCourtyardMissing->GetValue() );
m_config->Write( TestFootprintCourtyardKey, m_cbCourtyardOverlap->GetValue() );
m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
// Disonnect events
m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
wxMouseEventHandler(
@ -134,7 +137,8 @@ void DIALOG_DRC_CONTROL::InitValues()
wxMouseEventHandler(
DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
this->Connect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL, this );
this->Connect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL,
this );
m_DeleteCurrentMarkerButton->Enable( false );
@ -147,7 +151,8 @@ void DIALOG_DRC_CONTROL::InitValues()
m_cbCourtyardMissing->SetValue( value );
m_config->Read( TestFootprintCourtyardKey, &value, false );
m_cbCourtyardOverlap->SetValue( value );
m_config->Read( RefillZonesBeforeDrc, &value, false );
m_cbRefillZones->SetValue( value );
// Set the initial "enabled" status of the browse button and the text
// field for report name
@ -179,12 +184,14 @@ void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName
m_RptFilenameCtrl->SetValue( aFileName );
}
void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
{
*aEnable = m_CreateRptCtrl->GetValue();
aFileName = m_RptFilenameCtrl->GetValue();
}
void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
{
wxString reportName;
@ -210,6 +217,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
true, // unconnected pads DRC test enabled
true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled
m_cbRefillZones->GetValue(),
m_cbCourtyardOverlap->GetValue(),
m_cbCourtyardMissing->GetValue(),
reportName, make_report );
@ -283,6 +291,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
true, // unconnected pads DRC test enabled
true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled
m_cbRefillZones->GetValue(),
m_cbCourtyardOverlap->GetValue(),
m_cbCourtyardMissing->GetValue(),
reportName, make_report );
@ -360,10 +369,6 @@ void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX1
*/
void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
{
m_RptFilenameCtrl->Enable( m_CreateRptCtrl->IsChecked() );
@ -541,6 +546,7 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
}
}
/* called when switching from Error list to Unconnected list
* To avoid mistakes, the current marker is selection is cleared
*/
@ -593,6 +599,7 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event )
// Find the selected DRC_ITEM in the listbox, position cursor there,
// at the first of the two pads.
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
if( item )
{
// When selecting a item, center it on GAL and just move the graphic

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 2 2017)
// C++ code generated with wxFormBuilder (version Feb 9 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_drclistbox.h"
@ -105,8 +105,11 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
bSizerOptSettings->Add( fgMinValuesSizer, 0, wxEXPAND, 5 );
m_cbRefillZones = new wxCheckBox( this, wxID_ANY, _("Refill all zones before performing DRC"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbRefillZones, 0, wxLEFT|wxRIGHT, 5 );
m_cbCourtyardOverlap = new wxCheckBox( this, wxID_ANY, _("Check footprint courtyard overlap"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbCourtyardOverlap, 0, wxALL, 5 );
bSizerOptSettings->Add( m_cbCourtyardOverlap, 0, wxLEFT|wxRIGHT, 5 );
m_cbCourtyardMissing = new wxCheckBox( this, wxID_ANY, _("Check courtyard missing in footprints"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbCourtyardMissing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -14,6 +14,7 @@
<property name="file">dialog_drc_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_drc_base</property>
<property name="namespace"></property>
@ -1197,7 +1198,95 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<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="checked">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">Refill all zones before performing DRC</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_cbRefillZones</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"></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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 2 2017)
// C++ code generated with wxFormBuilder (version Feb 9 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DRC_BASE_H__
@ -11,7 +11,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class DRCLISTBOX;
#include "dialog_shim.h"
@ -63,6 +62,7 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
wxStaticText* m_ViaMinUnit;
wxStaticText* m_MicroViaMinTitle;
wxStaticText* m_MicroViaMinUnit;
wxCheckBox* m_cbRefillZones;
wxCheckBox* m_cbCourtyardOverlap;
wxCheckBox* m_cbCourtyardMissing;
wxStaticText* m_staticTextRpt;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2017 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2017-2018 KiCad Developers, see change_log.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
@ -76,7 +76,7 @@ void DRC::ShowDRCDialog( wxWindow* aParent )
m_drcDialog = new DIALOG_DRC_CONTROL( this, m_pcbEditorFrame, aParent );
updatePointers();
m_drcDialog->SetRptSettings( m_doCreateRptFile, m_rptFilename);
m_drcDialog->SetRptSettings( m_doCreateRptFile, m_rptFilename );
if( show_dlg_modal )
m_drcDialog->ShowModal();
@ -130,7 +130,7 @@ DRC::DRC( PCB_EDIT_FRAME* aPcbWindow )
m_doNoCourtyardDefined = true; // enable missing courtyard in footprint warning
m_abortDRC = false;
m_drcInProgress = false;
m_refillZones = false; // Only fill zones if requested by user.
m_doCreateRptFile = false;
// m_rptFilename set to empty by its constructor
@ -252,7 +252,7 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
wxString msg1 = zoneRef->GetSelectMenuText();
wxString msg2 = zoneToTest->GetSelectMenuText();
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA,
pt, msg1, pt, msg2, pt );
pt, msg1, pt, msg2, pt );
commit.Add( marker );
}
@ -282,7 +282,6 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
}
}
// Iterate through all the segments of refSmoothedPoly
for( auto refIt = refSmoothedPoly.IterateSegmentsWithHoles(); refIt; refIt++ )
{
@ -323,7 +322,7 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
wxString msg1 = zoneRef->GetSelectMenuText();
wxString msg2 = zoneToTest->GetSelectMenuText();
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_CLOSE_TO_COPPERAREA,
pt, msg1, pt, msg2, pt );
pt, msg1, pt, msg2, pt );
commit.Add( marker );
}
@ -410,7 +409,12 @@ void DRC::RunTests( wxTextCtrl* aMessages )
// caller (a wxTopLevelFrame) is the wxDialog or the Pcb Editor frame that call DRC:
wxWindow* caller = aMessages ? aMessages->GetParent() : m_pcbEditorFrame;
m_pcbEditorFrame->Fill_All_Zones( caller );
if( m_refillZones )
{
aMessages->AppendText( _( "Refilling all zones...\n" ) );
m_pcbEditorFrame->Fill_All_Zones( caller );
}
// test zone clearances to other zones
if( aMessages )
@ -454,7 +458,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
testTexts();
// find overlaping courtyard ares.
// find overlapping courtyard ares.
if( m_doFootprintOverlapping || m_doNoCourtyardDefined )
{
if( aMessages )
@ -632,6 +636,7 @@ void DRC::testPad2Pad()
// GetBoundingRadius() is the radius of the minimum sized circle fully containing the pad
int radius = pad->GetBoundingRadius();
if( radius > max_size )
max_size = radius;
}
@ -662,6 +667,7 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
const int delta = 500; // This is the number of tests between 2 calls to the
// progress bar
int count = 0;
for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() )
count++;
@ -682,7 +688,7 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
for( TRACK* segm = m_pcb->m_Track; segm; segm = segm->Next() )
{
if ( ii++ > delta )
if( ii++ > delta )
{
ii = 0;
count++;
@ -718,7 +724,7 @@ void DRC::testUnconnected()
auto connectivity = m_pcb->GetConnectivity();
connectivity->Clear();
connectivity->Build(m_pcb); // just in case. This really needs to be reliable.
connectivity->Build( m_pcb ); // just in case. This really needs to be reliable.
connectivity->RecalculateRatsnest();
std::vector<CN_EDGE> edges;
@ -750,7 +756,7 @@ void DRC::testZones()
// This is allowed, but i am not sure this is a good idea
//
// In recent Pcbnew versions, the netcode is always >= 0, but an internal net name
// is stored, and initalized from the file or the zone properpies editor.
// is stored, and initialized from the file or the zone properties editor.
// if it differs from the net name from net code, there is a DRC issue
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
@ -796,7 +802,7 @@ void DRC::testKeepoutAreas()
{
if( segm->Type() == PCB_TRACE_T )
{
if( ! area->GetDoNotAllowTracks() )
if( !area->GetDoNotAllowTracks() )
continue;
// Ignore if the keepout zone is not on the same layer
@ -843,7 +849,7 @@ void DRC::testTexts()
for( auto item : m_pcb->Drawings() )
{
// Drc test only items on copper layers
if( ! IsCopperLayer( item->GetLayer() ) )
if( !IsCopperLayer( item->GetLayer() ) )
continue;
// only texts on copper layers are tested
@ -861,7 +867,7 @@ void DRC::testTexts()
for( TRACK* track = m_pcb->m_Track; track != NULL; track = track->Next() )
{
if( ! track->IsOnLayer( item->GetLayer() ) )
if( !track->IsOnLayer( item->GetLayer() ) )
continue;
// Test the distance between each segment and the current track/via
@ -913,7 +919,7 @@ void DRC::testTexts()
{
D_PAD* pad = padList[ii];
if( ! pad->IsOnLayer( item->GetLayer() ) )
if( !pad->IsOnLayer( item->GetLayer() ) )
continue;
wxPoint shape_pos = pad->ShapePos();
@ -970,7 +976,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
if( aRefSeg->Type() == PCB_TRACE_T )
{
if( ! area->GetDoNotAllowTracks() )
if( !area->GetDoNotAllowTracks() )
continue;
if( !area->IsOnLayer( aRefSeg->GetLayer() ) )
@ -986,7 +992,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
}
else if( aRefSeg->Type() == PCB_VIA_T )
{
if( ! area->GetDoNotAllowVias() )
if( !area->GetDoNotAllowVias() )
continue;
auto viaLayers = aRefSeg->GetLayerSet();
@ -1203,7 +1209,8 @@ bool DRC::doFootprintOverlappingDrc()
courtyard.Append( footprint->GetPolyCourtyardFront() );
// Build the common area between footprint and the candidate:
courtyard.BooleanIntersection( candidate->GetPolyCourtyardFront(), SHAPE_POLY_SET::PM_FAST );
courtyard.BooleanIntersection( candidate->GetPolyCourtyardFront(),
SHAPE_POLY_SET::PM_FAST );
// If no overlap, courtyard is empty (no common area).
// Therefore if a common polygon exists, this is a DRC error
@ -1215,7 +1222,8 @@ bool DRC::doFootprintOverlappingDrc()
candidate->GetReference().GetData() );
VECTOR2I& pos = courtyard.Vertex( 0, 0, -1 );
wxPoint loc( pos.x, pos.y );
m_currentMarker = fillMarker( loc, DRCE_OVERLAPPING_FOOTPRINTS, msg, m_currentMarker );
m_currentMarker = fillMarker( loc, DRCE_OVERLAPPING_FOOTPRINTS, msg,
m_currentMarker );
addMarkerToPcb( m_currentMarker );
m_currentMarker = nullptr;
success = false;
@ -1238,7 +1246,8 @@ bool DRC::doFootprintOverlappingDrc()
courtyard.Append( footprint->GetPolyCourtyardBack() );
// Build the common area between footprint and the candidate:
courtyard.BooleanIntersection( candidate->GetPolyCourtyardBack(), SHAPE_POLY_SET::PM_FAST );
courtyard.BooleanIntersection( candidate->GetPolyCourtyardBack(),
SHAPE_POLY_SET::PM_FAST );
// If no overlap, courtyard is empty (no common area).
// Therefore if a common polygon exists, this is a DRC error
@ -1250,7 +1259,8 @@ bool DRC::doFootprintOverlappingDrc()
candidate->GetReference().GetData() );
VECTOR2I& pos = courtyard.Vertex( 0, 0, -1 );
wxPoint loc( pos.x, pos.y );
m_currentMarker = fillMarker( loc, DRCE_OVERLAPPING_FOOTPRINTS, msg, m_currentMarker );
m_currentMarker = fillMarker( loc, DRCE_OVERLAPPING_FOOTPRINTS, msg,
m_currentMarker );
addMarkerToPcb( m_currentMarker );
m_currentMarker = nullptr;
success = false;
@ -1260,4 +1270,3 @@ bool DRC::doFootprintOverlappingDrc()
return success;
}

View File

@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2016 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2017 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2017-2018 KiCad Developers, see change_log.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
@ -106,8 +106,7 @@ class NETCLASS;
/**
* Class DRC_ITEM_LIST
* provides an abstract interface of a DRC_ITEM* list manager. The details
* Provide an abstract interface of a DRC_ITEM* list manager. The details
* of the actual list architecture are hidden from the caller. Any class
* that implements this interface can then be used by a DRCLISTBOX class without
* it knowing the actual architecture of the list.
@ -153,8 +152,7 @@ typedef std::vector<DRC_ITEM*> DRC_LIST;
/**
* Class DRC
* is the Design Rule Checker, and performs all the DRC tests. The output of
* Design Rule Checker object that performs all the DRC tests. The output of
* the checking goes to the BOARD file in the form of two MARKER lists. Those
* two lists are displayable in the drc dialog box. And they can optionally
* be sent to a text file on disk.
@ -168,7 +166,6 @@ class DRC
private:
// protected or private functions() are lowercase first character.
bool m_doPad2PadTest;
bool m_doUnconnectedTest;
bool m_doZonesTest;
@ -176,6 +173,7 @@ private:
bool m_doCreateRptFile;
bool m_doFootprintOverlapping;
bool m_doNoCourtyardDefined;
bool m_refillZones;
wxString m_rptFilename;
@ -215,18 +213,15 @@ private:
/**
* Function updatePointers
* is a private helper function used to update needed pointers from the
* one pointer which is known not to change, m_pcbEditorFrame.
* Update needed pointers from the one pointer which is known not to change.
*/
void updatePointers();
/**
* Function fillMarker
* optionally creates a marker and fills it in with information,
* but does not add it to the BOARD. Use this to report any kind of
* DRC problem, or unconnected pad problem.
* Creates a marker and fills it in with information but does not add it to the BOARD.
*
* Use this to report any kind of DRC problem or unconnected pad problem.
*
* @param aTrack The reference track.
* @param aItem Another item on the BOARD, such as a VIA, SEGZONE,
@ -236,7 +231,8 @@ private:
* @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to
* first be allocated, then filled.
*/
MARKER_PCB* fillMarker( const TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe );
MARKER_PCB* fillMarker( const TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode,
MARKER_PCB* fillMe );
MARKER_PCB* fillMarker( D_PAD* aPad, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe );
@ -246,10 +242,9 @@ private:
const wxString& aMessage, MARKER_PCB* fillMe );
/**
* Function fillMarker
* optionally creates a marker and fills it in with information,
* but does not add it to the BOARD. Use this to report any kind of
* DRC problem, or unconnected pad problem.
* Create a marker and fills it in with information but do not add it to the BOARD.
*
* Use this to report any kind of DRC problem, or unconnected pad problem.
*
* @param aArea The zone to test
* @param aPos position of error
@ -263,24 +258,21 @@ private:
MARKER_PCB* fillMe );
/**
* Function fillMarker
* fills a MARKER which will report on a generic problem with the board which is
* Fill a MARKER which will report on a generic problem with the board which is
* not geographically locatable.
*/
MARKER_PCB* fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PCB* fillMe );
/**
* Function addMarkerToPcb
* Adds a DRC marker to the PCB throught the COMMIT mechanism.
* Adds a DRC marker to the PCB through the COMMIT mechanism.
*/
void addMarkerToPcb( MARKER_PCB* aMarker );
//-----<categorical group tests>-----------------------------------------
/**
* Function testNetClasses
* goes through each NETCLASS and verifies that its clearance, via size,
* track width, and track clearance are larger than those in board.m_designSettings.
* Go through each NETCLASS and verifies that its clearance, via size, track width, and
* track clearance are larger than those in board.m_designSettings.
* This is necessary because the actual DRC checks are run against the NETCLASS
* limits, so in order enforce global limits, we first check the NETCLASSes against
* the global limits.
@ -290,9 +282,9 @@ private:
bool testNetClasses();
/**
* Function testTracks
* performs the DRC on all tracks.
* because this test can take a while, a progress bar can be displayed
* Perform the DRC on all tracks.
*
* This test can take a while, a progress bar can be displayed
* @param aActiveWindow = the active window ued as parent for the progress bar
* @param aShowProgressBar = true to show a progress bar
* (Note: it is shown only if there are many tracks)
@ -314,9 +306,10 @@ private:
bool doNetClass( const std::shared_ptr<NETCLASS>& aNetClass, wxString& msg );
/**
* Function doPadToPadsDrc
* tests the clearance between aRefPad and other pads.
* Test the clearance between aRefPad and other pads.
*
* The pad list must be sorted by x coordinate.
*
* @param aRefPad The pad to test
* @param aStart The start of the pad list to test against
* @param aEnd Marks the end of the list and is not included
@ -325,31 +318,31 @@ private:
bool doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit );
/**
* Function DoTrackDrc
* tests the current segment.
* Test the current segment.
*
* @param aRefSeg The segment to test
* @param aStart The head of a list of tracks to test against (usually BOARD::m_Track)
* @param doPads true if should do pads test
* @return bool - true if no poblems, else false and m_currentMarker is
* @return bool - true if no problems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true );
/**
* Function doTrackKeepoutDrc
* tests the current segment or via.
* Test the current segment or via.
*
* @param aRefSeg The segment to test
* @return bool - true if no poblems, else false and m_currentMarker is
* @return bool - true if no problems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackKeepoutDrc( TRACK* aRefSeg );
/**
* Function doEdgeZoneDrc
* tests a segment in ZONE_CONTAINER * aArea:
* Test a segment in ZONE_CONTAINER * aArea:
* Test Edge inside other areas
* Test Edge too close other areas
*
* @param aArea The current area.
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK
@ -357,8 +350,8 @@ private:
bool doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex );
/**
* Function doFootprintOverlappingDrc
* tests for footprint courtyard overlaps
* Test for footprint courtyard overlaps.
*
* @return bool - false if DRC error or true if OK
*/
bool doFootprintOverlappingDrc();
@ -366,7 +359,6 @@ private:
//-----<single tests>----------------------------------------------
/**
* Function checkClearancePadToPad
* @param aRefPad The reference pad to check
* @param aPad Another pad to check against
* @return bool - true if clearance between aRefPad and aPad is >= dist_min, else false
@ -375,8 +367,7 @@ private:
/**
* Function checkClearanceSegmToPad
* check the distance from a pad to segment. This function uses several
* Check the distance from a pad to segment. This function uses several
* instance variable not passed in:
* m_segmLength = length of the segment being tested
* m_segmAngle = angle of the segment with the X axis;
@ -393,8 +384,8 @@ private:
/**
* Helper function checkMarginToCircle
* Check the distance from a point to a segment.
*
* The segment is expected starting at 0,0, and on the X axis
* (used to test DRC between a segment and a round pad, via or round end of a track
* @param aCentre The coordinate of the circle's center
@ -447,9 +438,9 @@ public:
int Drc( ZONE_CONTAINER* aArea, int aCornerIndex );
/**
* Function DrcBlind
* tests the current segment and returns the result. Any error is not
* Test the current segment and returns the result. Any error is not
* displayed in the status panel.
*
* @param aRefSeg The current segment to test.
* @param aList The track list to test (usually m_Pcb->m_Track)
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
@ -475,10 +466,10 @@ public:
int TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers );
/**
* Function ShowDRCDialog
* opens a dialog and prompts the user, then if a test run button is
* Open a dialog and prompts the user, then if a test run button is
* clicked, runs the test(s) and creates the MARKERS. The dialog is only
* created if it is not already in existence.
*
* @param aParent is the parent window for wxWidgets. Usually the PCB editor frame
* but can be an other dialog
* if aParent == NULL (default), the parent will be the PCB editor frame
@ -490,22 +481,23 @@ public:
void ShowDRCDialog( wxWindow* aParent = NULL );
/**
* Function DestroyDRCDialog
* deletes this ui dialog box and zeros out its pointer to remember
* Deletes this ui dialog box and zeros out its pointer to remember
* the state of the dialog's existence.
*
* @param aReason Indication of which button was clicked to cause the destruction.
* if aReason == wxID_OK, design parameters values which can be entered from the dialog will bbe saved
* in design parameters list
* if aReason == wxID_OK, design parameters values which can be entered from the dialog
* will bbe saved in design parameters list
*/
void DestroyDRCDialog( int aReason );
/**
* Function SetSettings
* saves all the UI or test settings and may be called before running the tests.
* Save all the UI or test settings and may be called before running the tests.
*
* @param aPad2PadTest Tells whether to test pad to pad distances.
* @param aUnconnectedTest Tells whether to list unconnected pads.
* @param aZonesTest Tells whether to test zones.
* @param aRefillZones Refill zones before performing DRC.
* @param aKeepoutTest Tells whether to test keepout areas.
* @param aCourtyardTest Tells whether to test footprint courtyard overlap.
* @param aCourtyardMissingTest Tells whether to test missing courtyard definition in footprint.
@ -513,7 +505,7 @@ public:
* @param aSaveReport A boolean telling whether to generate disk file report.
*/
void SetSettings( bool aPad2PadTest, bool aUnconnectedTest,
bool aZonesTest, bool aKeepoutTest,
bool aZonesTest, bool aKeepoutTest, bool aRefillZones,
bool aCourtyardTest, bool aCourtyardMissingTest,
const wxString& aReportName, bool aSaveReport )
{
@ -525,20 +517,19 @@ public:
m_doCreateRptFile = aSaveReport;
m_doFootprintOverlapping = aCourtyardTest;
m_doNoCourtyardDefined = aCourtyardMissingTest;
m_refillZones = aRefillZones;
}
/**
* Function RunTests
* will actually run all the tests specified with a previous call to
* Run all the tests specified with a previous call to
* SetSettings()
* @param aMessages = a wxTextControl where to display some activity messages. Can be NULL
*/
void RunTests( wxTextCtrl* aMessages = NULL );
/**
* Function ListUnconnectedPad
* gathers a list of all the unconnected pads and shows them in the
* Gather a list of all the unconnected pads and shows them in the
* dialog, and optionally prints a report of such.
*/
void ListUnconnectedPads();
@ -555,5 +546,3 @@ public:
#endif // DRC_H
//EOF