Add proper collision test to via placer.

Also moves DISALLOW constraint processing outside the loop as it
performs it's own loop over any objects referenced by the rules.

Fixes https://gitlab.com/kicad/code/kicad/issues/11832

(cherry picked from commit 73836b50fc)
This commit is contained in:
Jeff Young 2022-06-19 21:45:33 +01:00
parent 2fdddb970f
commit 0f882d91e5
1 changed files with 9 additions and 9 deletions

View File

@ -2416,16 +2416,10 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
if( ( aOther->Type() == PCB_ZONE_T || aOther->Type() == PCB_FP_ZONE_T )
&& static_cast<ZONE*>( aOther )->GetIsRuleArea() )
{
ZONE* zone = static_cast<ZONE*>( aOther );
ZONE* ruleArea = static_cast<ZONE*>( aOther );
if( zone->GetDoNotAllowVias() )
return true;
constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr,
UNDEFINED_LAYER );
if( constraint.m_DisallowFlags )
return true;
if( ruleArea->GetDoNotAllowVias() )
return ruleArea->Outline()->Collide( aVia->GetPosition(), aVia->GetWidth() / 2 );
return false;
}
@ -2531,6 +2525,12 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
checkedItems.insert( item );
}
DRC_CONSTRAINT constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr,
UNDEFINED_LAYER );
if( constraint.m_DisallowFlags )
return true;
return false;
}