When selecting a track keep going to pad center.

The previous algorithm stopped whenever it entered a pad, which
sometimes leaves small track segments inside the pad.  This one
keeps going as long as each segment gets us closer to the center
of the pad.

Fixes: lp:1662398
* https://bugs.launchpad.net/kicad/+bug/1662398
This commit is contained in:
Jeff Young 2018-01-04 16:10:17 +00:00 committed by Wayne Stambaugh
parent 8de0598789
commit 5bc5942f36
1 changed files with 18 additions and 3 deletions

View File

@ -395,6 +395,9 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerSet, TRACK
if( !m_Track ) // no tracks at all in board
return;
D_PAD* pad = NULL;
double distanceToPadCenter;
/* Set the BUSY flag of all connected segments, first search starting at
* aPosition. The search ends when a pad is found (end of a track), a
* segment end has more than one other segment end connected, or when no
@ -411,9 +414,10 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerSet, TRACK
for( ; ; )
{
if( GetPad( aPosition, layer_set ) != NULL )
return;
if( !pad )
pad = GetPad( aPosition, layer_set );
if( pad )
distanceToPadCenter = GetLineLength( aPosition, pad->GetCenter() );
/* Test for a via: a via changes the layer mask and can connect a lot
* of segments at location aPosition. When found, the via is just
@ -481,6 +485,17 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerSet, TRACK
aPosition = candidate->GetStart();
}
/* If we are in a pad, only candidates approaching the pad center
* are accepted.
*/
if( pad )
{
if( GetPad( aPosition, layer_set ) != pad )
return;
if( GetLineLength( aPosition, pad->GetCenter() ) > distanceToPadCenter )
return;
}
layer_set = candidate->GetLayerSet();
// flag this item and push it in list of selected items