Don't consider non-tracks when seeing if we can do a router drag.
Fixes: lp:1793979 * https://bugs.launchpad.net/kicad/+bug/1793979
This commit is contained in:
parent
66848b9334
commit
4b493e45eb
|
@ -1061,7 +1061,8 @@ void ROUTER_TOOL::performDragging( int aMode )
|
||||||
|
|
||||||
void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
|
void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
|
||||||
{
|
{
|
||||||
/* If the collection contains a trivial line corner (two connected segments)
|
/*
|
||||||
|
* If the collection contains a trivial line corner (two connected segments)
|
||||||
* or a non-fanout-via (a via with no more than two connected segments), then
|
* or a non-fanout-via (a via with no more than two connected segments), then
|
||||||
* trim the collection down to a single item (which one won't matter since
|
* trim the collection down to a single item (which one won't matter since
|
||||||
* they're all connected).
|
* they're all connected).
|
||||||
|
@ -1082,40 +1083,33 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
|
||||||
|
|
||||||
int refNet = reference->GetNetCode();
|
int refNet = reference->GetNetCode();
|
||||||
|
|
||||||
wxPoint refPoint;
|
wxPoint refPoint( aPt.x, aPt.y );
|
||||||
STATUS_FLAGS flags = reference->IsPointOnEnds( wxPoint( aPt.x, aPt.y ), -1 );
|
STATUS_FLAGS flags = reference->IsPointOnEnds( refPoint, -1 );
|
||||||
|
|
||||||
if( flags & STARTPOINT )
|
if( flags & STARTPOINT )
|
||||||
refPoint = reference->GetStart();
|
refPoint = reference->GetStart();
|
||||||
else if( flags & ENDPOINT )
|
else if( flags & ENDPOINT )
|
||||||
refPoint = reference->GetEnd();
|
refPoint = reference->GetEnd();
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Check all items to ensure that they are TRACKs which are co-terminus
|
// Check all items to ensure that any TRACKs are co-terminus with the reference and on
|
||||||
// with the reference, and on the same net. Ignore markers.
|
// the same net.
|
||||||
for( int i = 0; i < aCollector.GetCount(); i++ )
|
for( int i = 0; i < aCollector.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
|
TRACK* neighbor = dynamic_cast<TRACK*>( aCollector[i] );
|
||||||
|
|
||||||
if( item->Type() == PCB_MARKER_T )
|
if( neighbor && neighbor != reference )
|
||||||
continue;
|
{
|
||||||
|
if( neighbor->GetNetCode() != refNet )
|
||||||
TRACK* neighbor = dynamic_cast<TRACK*>( item );
|
|
||||||
|
|
||||||
if( !neighbor || neighbor->GetNetCode() != refNet )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( neighbor->GetStart() != refPoint && neighbor->GetEnd() != refPoint )
|
if( neighbor->GetStart() != refPoint && neighbor->GetEnd() != refPoint )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Selection meets criteria; trim it to the reference item.
|
// Selection meets criteria; trim it to the reference item.
|
||||||
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
|
aCollector.Empty();
|
||||||
{
|
aCollector.Append( reference );
|
||||||
if( dynamic_cast<TRACK*>( aCollector[i] ) != reference )
|
|
||||||
aCollector.Remove( i );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue