Give excluded DRC items their own layer.

(And fix a bug with the new mulit-layer zones and rule-based keepouts
at the same time which prevented me from testing it.)

Fixes https://gitlab.com/kicad/code/kicad/issues/4954
This commit is contained in:
Jeff Young 2020-07-24 01:25:34 +01:00
parent 6529e339a9
commit f97c50bfde
9 changed files with 32 additions and 7 deletions

View File

@ -188,6 +188,9 @@ wxString LayerName( int aLayer )
case LAYER_DRC_ERROR:
return _( "DRC Errors" );
case LAYER_DRC_EXCLUSION:
return _( "DRC Exclusions" );
case LAYER_ANCHOR:
return _( "Anchors" );

View File

@ -126,6 +126,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( std::string aFilename ) :
CLR( "board.cursor", LAYER_CURSOR, COLOR4D( WHITE ) );
CLR( "board.drc_error", LAYER_DRC_ERROR, COLOR4D( PURERED ) );
CLR( "board.drc_warning", LAYER_DRC_WARNING, COLOR4D( PUREYELLOW ) );
CLR( "board.drc_exclusion", LAYER_DRC_EXCLUSION, COLOR4D( WHITE ) );
CLR( "board.footprint_text_back", LAYER_MOD_TEXT_BK, COLOR4D( BLUE ) );
CLR( "board.footprint_text_front", LAYER_MOD_TEXT_FR, COLOR4D( LIGHTGRAY ) );
CLR( "board.footprint_text_invisible", LAYER_MOD_TEXT_INVISIBLE, COLOR4D( LIGHTGRAY ) );

View File

@ -195,6 +195,7 @@ enum GAL_LAYER_ID: int
LAYER_VIAS_HOLES, ///< to draw via holes (pad holes do not use this layer)
LAYER_DRC_ERROR, ///< layer for drc markers with SEVERITY_ERROR
LAYER_DRC_WARNING, ///< layer for drc markers with SEVERITY_WARNING
LAYER_DRC_EXCLUSION, ///< layer for drc markers which have been individually excluded
LAYER_WORKSHEET, ///< worksheet frame
LAYER_GP_OVERLAY, ///< general purpose overlay
LAYER_SELECT_OVERLAY, ///< currently selected items overlay

View File

@ -159,6 +159,12 @@ void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
if( IsExcluded() )
{
aLayers[0] = LAYER_DRC_EXCLUSION;
return;
}
BOARD_ITEM_CONTAINER* ancestor = GetParent();
while( ancestor->GetParent() )
@ -178,7 +184,7 @@ void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
GAL_LAYER_ID MARKER_PCB::GetColorLayer() const
{
if( IsExcluded() )
return LAYER_AUX_ITEMS;
return LAYER_DRC_EXCLUSION;
BOARD_ITEM_CONTAINER* ancestor = GetParent();

View File

@ -594,6 +594,11 @@ public:
}
}
bool HasFilledPolysForLayer( PCB_LAYER_ID aLayer ) const
{
return m_FilledPolysList.count( aLayer ) > 0;
}
/**
* Function GetFilledPolysList
* returns a reference to the list of filled polygons.

View File

@ -1251,7 +1251,7 @@ wxPoint DRC::GetLocation( TRACK* aTrack, ZONE_CONTAINER* aConflictZone )
PCB_LAYER_ID l = aTrack->GetLayer();
if( aConflictZone->IsFilled() )
if( aConflictZone->IsFilled() && aConflictZone->HasFilledPolysForLayer( l ) )
conflictOutline = const_cast<SHAPE_POLY_SET*>( &aConflictZone->GetFilledPolysList( l ) );
else
conflictOutline = aConflictZone->Outline();

View File

@ -113,6 +113,14 @@ DRC_RULE_CONDITION::~DRC_RULE_CONDITION()
bool DRC_RULE_CONDITION::EvaluateFor( const BOARD_ITEM* aItemA, const BOARD_ITEM* aItemB )
{
// An unconditional rule is always true
if( m_Expression.IsEmpty() )
return true;
// A rule which failed to compile is always false
if( !m_ucode )
return false;
BOARD_ITEM* a = const_cast<BOARD_ITEM*>( aItemA );
BOARD_ITEM* b = aItemB ? const_cast<BOARD_ITEM*>( aItemB ) : DELETED_BOARD_ITEM::GetInstance();

View File

@ -53,7 +53,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
{
LAYER_GP_OVERLAY,
LAYER_SELECT_OVERLAY,
LAYER_DRC_ERROR, LAYER_DRC_WARNING,
LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION,
LAYER_PADS_NETNAMES, LAYER_VIAS_NETNAMES,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
@ -289,10 +289,10 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
// Layers that should always have on-top attribute enabled
const std::vector<LAYER_NUM> layers = {
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES,
LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES,
LAYER_NON_PLATEDHOLES, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST, LAYER_DRC_ERROR, LAYER_DRC_WARNING
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES, LAYER_PADS_TH,
LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES, LAYER_NON_PLATEDHOLES,
LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY, LAYER_RATSNEST, LAYER_DRC_ERROR,
LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION
};
for( auto layer : layers )

View File

@ -71,6 +71,7 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "DRC Warnings" ), LAYER_DRC_WARNING, YELLOW, _( "DRC violations with a Warning severity" ) ),
RR( _( "DRC Errors" ), LAYER_DRC_ERROR, PURERED, _( "DRC violations with an Error severity" ) ),
RR( _( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, WHITE, _( "DRC violations which have been individually excluded" ) ),
RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ),