connectivity: Check all anchors for connection
With pads, we should check available anchor points for each connection,
increasing probability of finding connection to match fill algorithm
Fixes: lp:1844661
* https://bugs.launchpad.net/kicad/+bug/1844661
(cherry picked from commit b7128639f8
)
This commit is contained in:
parent
2bd0bae2f7
commit
92b6e05909
|
@ -698,17 +698,24 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
|
||||||
|
|
||||||
// Items do not necessarily have reciprocity as we only check for anchors
|
// Items do not necessarily have reciprocity as we only check for anchors
|
||||||
// therefore, we check HitTest both directions A->B & B->A
|
// therefore, we check HitTest both directions A->B & B->A
|
||||||
// TODO: Check for collision geometry on extended features
|
for( int i = 0; i < aCandidate->AnchorCount(); ++i )
|
||||||
wxPoint ptA1( aCandidate->GetAnchor( 0 ).x, aCandidate->GetAnchor( 0 ).y );
|
{
|
||||||
wxPoint ptA2( aCandidate->GetAnchor( 1 ).x, aCandidate->GetAnchor( 1 ).y );
|
if( parentB->HitTest( wxPoint( aCandidate->GetAnchor( i ) ) ) )
|
||||||
wxPoint ptB1( m_item->GetAnchor( 0 ).x, m_item->GetAnchor( 0 ).y );
|
|
||||||
wxPoint ptB2( m_item->GetAnchor( 1 ).x, m_item->GetAnchor( 1 ).y );
|
|
||||||
if( parentA->HitTest( ptB1 ) || parentB->HitTest( ptA1 ) ||
|
|
||||||
( parentA->Type() == PCB_TRACE_T && parentB->HitTest( ptA2 ) ) ||
|
|
||||||
( parentB->Type() == PCB_TRACE_T && parentA->HitTest( ptB2 ) ) )
|
|
||||||
{
|
{
|
||||||
m_item->Connect( aCandidate );
|
m_item->Connect( aCandidate );
|
||||||
aCandidate->Connect( m_item );
|
aCandidate->Connect( m_item );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < m_item->AnchorCount(); ++i )
|
||||||
|
{
|
||||||
|
if( parentA->HitTest( wxPoint( m_item->GetAnchor( i ) ) ) )
|
||||||
|
{
|
||||||
|
m_item->Connect( aCandidate );
|
||||||
|
aCandidate->Connect( m_item );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue