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
This commit is contained in:
Seth Hillbrand 2024-04-19 16:30:00 -07:00
parent 4e6a3a50fc
commit b346cde30b
1 changed files with 15 additions and 1 deletions

View File

@ -711,7 +711,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 )
@ -1165,6 +1173,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() );