Implement correct layer handling for keepout constraints.

This commit is contained in:
Jeff Young 2020-10-25 22:35:47 +00:00
parent ec11697660
commit 2ee61f52ca
1 changed files with 37 additions and 11 deletions

View File

@ -392,6 +392,8 @@ void DRC_ENGINE::loadImplicitRules()
rule->m_Condition = new DRC_RULE_CONDITION( wxString::Format( "A.insideArea('%s')", rule->m_Condition = new DRC_RULE_CONDITION( wxString::Format( "A.insideArea('%s')",
name ) ); name ) );
rule->m_LayerCondition = zone->GetLayerSet();
if( zone->GetDoNotAllowTracks() ) if( zone->GetDoNotAllowTracks() )
addKeepoutConstraint( DRC_DISALLOW_TRACKS ); addKeepoutConstraint( DRC_DISALLOW_TRACKS );
@ -841,31 +843,52 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI
if( ( c->constraint.m_DisallowFlags & mask ) == 0 ) if( ( c->constraint.m_DisallowFlags & mask ) == 0 )
{ {
if( implicit ) if( implicit )
{
REPORT( _( "Keepout constraint not met." ) ) REPORT( _( "Keepout constraint not met." ) )
else
REPORT( _( "Disallow constraint not met." ) )
// Keepout areas unioned in classic system
return false; return false;
} }
if( !( c->layerTest & a->GetLayerSet() ).any() )
{
if( implicit )
{
REPORT( _( "Keepout layer(s) not matched." ) )
}
else if( c->parentRule )
{
REPORT( wxString::Format( _( "Rule layer \"%s\" not matched." ),
c->parentRule->m_LayerSource ) )
REPORT( "Rule ignored." )
}
else else
{ {
REPORT( _( "Disallow constraint not met." ) ) REPORT( _( "Rule layer not matched." ) )
REPORT( "Rule ignored." )
// First matching rule wins in rule system
REPORT( "Item allowed." );
return true;
} }
return false;
} }
} }
if( aLayer != UNDEFINED_LAYER && !c->layerTest.test( aLayer ) ) if( aLayer != UNDEFINED_LAYER && !c->layerTest.test( aLayer ) )
{ {
if( c->parentRule ) if( implicit )
{
REPORT( "Constraint layer not matched." )
}
else if( c->parentRule )
{ {
REPORT( wxString::Format( _( "Rule layer \"%s\" not matched." ), REPORT( wxString::Format( _( "Rule layer \"%s\" not matched." ),
c->parentRule->m_LayerSource ) ) c->parentRule->m_LayerSource ) )
REPORT( "Rule ignored." ) REPORT( "Rule ignored." )
} }
else
{
REPORT( _( "Rule layer not matched." ) )
REPORT( "Rule ignored." )
}
return false; return false;
} }
@ -879,9 +902,12 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI
return true; return true;
} }
else else
{
if( implicit )
{ {
// Don't report on implicit rule conditions; they're synthetic. // Don't report on implicit rule conditions; they're synthetic.
if( !implicit ) }
else
{ {
REPORT( wxString::Format( _( "Checking rule condition \"%s\"." ), REPORT( wxString::Format( _( "Checking rule condition \"%s\"." ),
c->condition->GetExpression() ) ) c->condition->GetExpression() ) )