Show disambiguated netname when needed

When using subsheets with nets that end in the same netname, it can be
confusing in pcbnew to know which net you are dealing with.  In these
cases, we show the full netname including path to assist when routing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16187

(cherry picked from commit b346cde30b)
This commit is contained in:
Seth Hillbrand 2024-04-19 16:30:00 -07:00
parent eb7e781bec
commit f8f48f922e
1 changed files with 15 additions and 1 deletions

View File

@ -705,7 +705,15 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
return;
SHAPE_SEGMENT trackShape( { aTrack->GetStart(), aTrack->GetEnd() }, aTrack->GetWidth() );
renderNetNameForSegment( trackShape, color, aTrack->GetUnescapedShortNetname() );
wxString netname = aTrack->GetUnescapedShortNetname();
for( const auto& netinfo : aTrack->GetBoard()->GetNetInfo() )
{
if( netinfo->GetUnescapedShortNetname() == netname )
netname = UnescapeString( aTrack->GetNetname() );
}
renderNetNameForSegment( trackShape, color, netname );
return;
}
else if( IsCopperLayer( aLayer ) || aLayer == LAYER_LOCKED_ITEM_SHADOW )
@ -1159,6 +1167,12 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
if( netname.IsEmpty() && padNumber.IsEmpty() )
return;
for( const auto& netinfo : board->GetNetInfo() )
{
if( netinfo->GetUnescapedShortNetname() == netname )
netname = UnescapeString( aPad->GetNetname() );
}
BOX2I padBBox = aPad->GetBoundingBox();
VECTOR2D position = padBBox.Centre();
VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );