Browse Source

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)
8.0
Seth Hillbrand 2 years ago
parent
commit
f8f48f922e
  1. 16
      pcbnew/pcb_painter.cpp

16
pcbnew/pcb_painter.cpp

@ -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() );

Loading…
Cancel
Save