pcbnew: Handle intermediate pad on route
The length calculation wanted to find start/end pads but this was complicated for paths that had a via on the intermediate pad. Instead of warning, we calculate the longest path of the three possibilities Fixes: lp:1838261 * https://bugs.launchpad.net/kicad/+bug/1838261 Fixes #2554 | https://gitlab.com/kicad/code/kicad/issues/2554
This commit is contained in:
parent
8c7e0bcb0a
commit
20a5d8effd
|
@ -2078,9 +2078,27 @@ TRACK* BOARD::MarkTrace( TRACK* aTrackList, TRACK* aTrace, int* aCount,
|
|||
dist_fromend = dist;
|
||||
e_pad = pad_on_start;
|
||||
}
|
||||
else // Should not occur, at least for basic pads
|
||||
else // If we have a via in a pad in the middle of a trace
|
||||
{
|
||||
wxLogWarning( "Unexpected BOARD::MarkTrace: multiple pad_on_start" );
|
||||
// In this case, we want the distance between the farthest pads
|
||||
// Forgive me this anti-pattern. This is a v5-only fix, so complete refactor is
|
||||
// a non-starter.
|
||||
if( dist_fromend < dist_fromstart )
|
||||
{
|
||||
if( dist > dist_fromend )
|
||||
{
|
||||
dist_fromend = dist;
|
||||
e_pad = pad_on_start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( dist > dist_fromstart )
|
||||
{
|
||||
dist_fromstart = dist;
|
||||
s_pad = pad_on_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2099,9 +2117,27 @@ TRACK* BOARD::MarkTrace( TRACK* aTrackList, TRACK* aTrace, int* aCount,
|
|||
dist_fromend = dist;
|
||||
e_pad = pad_on_end;
|
||||
}
|
||||
else // Should not occur, at least for basic pads
|
||||
else // If we have a via in a pad in the middle of a trace
|
||||
{
|
||||
wxLogWarning( "Unexpected BOARD::MarkTrace: multiple pad_on_end" );
|
||||
// In this case, we want the distance between the farthest pads
|
||||
// Forgive me this anti-pattern. This is a v5-only fix, so complete refactor is
|
||||
// a non-starter.
|
||||
if( dist_fromend < dist_fromstart )
|
||||
{
|
||||
if( dist > dist_fromend )
|
||||
{
|
||||
dist_fromend = dist;
|
||||
e_pad = pad_on_start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( dist > dist_fromstart )
|
||||
{
|
||||
dist_fromstart = dist;
|
||||
s_pad = pad_on_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue