Move CN_VISITOR from HitTest() to Collide().
The former isn't sufficiently aware of layer differences (such as for
pads with some layers unflashed).
(cherry picked from commit 6e063247e5
)
This commit is contained in:
parent
7cba8e847d
commit
f561f85ebb
|
@ -765,7 +765,9 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
|
||||||
if( parentA == parentB )
|
if( parentA == parentB )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( !( parentA->GetLayerSet() & parentB->GetLayerSet() ).any() )
|
LSET commonLayers = parentA->GetLayerSet() & parentB->GetLayerSet();
|
||||||
|
|
||||||
|
if( !commonLayers.any() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// If both m_item and aCandidate are marked dirty, they will both be searched
|
// If both m_item and aCandidate are marked dirty, they will both be searched
|
||||||
|
@ -794,34 +796,9 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int accuracyA = 0;
|
for( PCB_LAYER_ID layer : commonLayers.Seq() )
|
||||||
int accuracyB = 0;
|
|
||||||
|
|
||||||
if( parentA->Type() == PCB_VIA_T
|
|
||||||
|| parentA->Type() == PCB_TRACE_T
|
|
||||||
|| parentA->Type() == PCB_ARC_T)
|
|
||||||
accuracyA = ( static_cast<const PCB_TRACK*>( parentA )->GetWidth() + 1 ) / 2;
|
|
||||||
|
|
||||||
if( parentB->Type() == PCB_VIA_T
|
|
||||||
|| parentB->Type() == PCB_TRACE_T
|
|
||||||
|| parentB->Type() == PCB_ARC_T )
|
|
||||||
accuracyB = ( static_cast<const PCB_TRACK*>( parentB )->GetWidth() + 1 ) / 2;
|
|
||||||
|
|
||||||
// Items do not necessarily have reciprocity as we only check for anchors
|
|
||||||
// therefore, we check HitTest both directions A->B & B->A
|
|
||||||
for( int i = 0; i < aCandidate->AnchorCount(); ++i )
|
|
||||||
{
|
{
|
||||||
if( parentB->HitTest( wxPoint( aCandidate->GetAnchor( i ) ), accuracyA ) )
|
if( parentA->GetEffectiveShape( layer )->Collide( parentB->GetEffectiveShape( layer ).get() ) )
|
||||||
{
|
|
||||||
m_item->Connect( aCandidate );
|
|
||||||
aCandidate->Connect( m_item );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for( int i = 0; i < m_item->AnchorCount(); ++i )
|
|
||||||
{
|
|
||||||
if( parentA->HitTest( wxPoint( m_item->GetAnchor( i ) ), accuracyB ) )
|
|
||||||
{
|
{
|
||||||
m_item->Connect( aCandidate );
|
m_item->Connect( aCandidate );
|
||||||
aCandidate->Connect( m_item );
|
aCandidate->Connect( m_item );
|
||||||
|
|
Loading…
Reference in New Issue