Don't include stale nets in net counts.

Fixes bug reported by Franck.
This commit is contained in:
Jeff Young 2021-09-28 10:41:39 +01:00
parent 9f841da98e
commit fac48ddafb
3 changed files with 49 additions and 57 deletions

View File

@ -1165,35 +1165,39 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
void BOARD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void BOARD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString txt; int padCount = 0;
int viasCount = 0; int viaCount = 0;
int trackSegmentsCount = 0; int trackSegmentCount = 0;
std::set<int> netCodes;
int unconnected = GetConnectivity()->GetUnconnectedCount();
for( PCB_TRACK* item : m_tracks ) for( PCB_TRACK* item : m_tracks )
{ {
if( item->Type() == PCB_VIA_T ) if( item->Type() == PCB_VIA_T )
viasCount++; viaCount++;
else else
trackSegmentsCount++; trackSegmentCount++;
if( item->GetNetCode() > 0 )
netCodes.insert( item->GetNetCode() );
} }
txt.Printf( wxT( "%d" ), GetPadCount() ); for( FOOTPRINT* footprint : Footprints() )
aList.emplace_back( _( "Pads" ), txt ); {
for( PAD* pad : footprint->Pads() )
{
padCount++;
txt.Printf( wxT( "%d" ), viasCount ); if( pad->GetNetCode() > 0 )
aList.emplace_back( _( "Vias" ), txt ); netCodes.insert( pad->GetNetCode() );
}
}
txt.Printf( wxT( "%d" ), trackSegmentsCount ); aList.emplace_back( _( "Pads" ), wxString::Format( "%d", padCount ) );
aList.emplace_back( _( "Track Segments" ), txt ); aList.emplace_back( _( "Vias" ), wxString::Format( "%d", viaCount ) );
aList.emplace_back( _( "Track Segments" ), wxString::Format( "%d", trackSegmentCount ) );
txt.Printf( wxT( "%d" ), GetNodesCount() ); aList.emplace_back( _( "Nets" ), wxString::Format( "%d", (int) netCodes.size() ) );
aList.emplace_back( _( "Nodes" ), txt ); aList.emplace_back( _( "Unrouted" ), wxString::Format( "%d", unconnected ) );
txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
aList.emplace_back( _( "Nets" ), txt );
txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
aList.emplace_back( _( "Unrouted" ), txt );
} }
@ -1925,17 +1929,6 @@ const std::vector<PAD*> BOARD::GetPads() const
} }
unsigned BOARD::GetPadCount() const
{
unsigned retval = 0;
for( FOOTPRINT* footprint : Footprints() )
retval += footprint->Pads().size();
return retval;
}
const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems() const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
{ {
std::vector<BOARD_CONNECTED_ITEM*> items; std::vector<BOARD_CONNECTED_ITEM*> items;

View File

@ -645,11 +645,6 @@ public:
*/ */
unsigned GetUnconnectedNetCount() const; unsigned GetUnconnectedNetCount() const;
/**
* @return the number of pads in board.
*/
unsigned GetPadCount() const;
/** /**
* Return a reference to a list of all the pads. * Return a reference to a list of all the pads.
* *

View File

@ -442,36 +442,40 @@ void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
std::vector<MSG_PANEL_ITEM>& aList ) std::vector<MSG_PANEL_ITEM>& aList )
{ {
BOARD* board = static_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() )->GetBoard(); BOARD* board = static_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() )->GetBoard();
wxString txt; int padCount = 0;
int viasCount = 0; int viaCount = 0;
int trackSegmentsCount = 0; int trackSegmentCount = 0;
std::set<int> netCodes;
int unconnected = board->GetConnectivity()->GetUnconnectedCount();
for( PCB_TRACK* item : board->Tracks() ) for( PCB_TRACK* item : board->Tracks() )
{ {
if( item->Type() == PCB_VIA_T ) if( item->Type() == PCB_VIA_T )
viasCount++; viaCount++;
else else
trackSegmentsCount++; trackSegmentCount++;
if( item->GetNetCode() > 0 )
netCodes.insert( item->GetNetCode() );
} }
txt.Printf( wxT( "%d" ), board->GetPadCount() ); for( FOOTPRINT* footprint : board->Footprints() )
aList.emplace_back( _( "Pads" ), txt ); {
for( PAD* pad : footprint->Pads() )
{
padCount++;
txt.Printf( wxT( "%d" ), viasCount ); if( pad->GetNetCode() > 0 )
aList.emplace_back( _( "Vias" ), txt ); netCodes.insert( pad->GetNetCode() );
}
}
txt.Printf( wxT( "%d" ), trackSegmentsCount ); aList.emplace_back( _( "Pads" ), wxString::Format( "%d", padCount ) );
aList.emplace_back( _( "Track Segments" ), txt ); aList.emplace_back( _( "Vias" ), wxString::Format( "%d", viaCount ) );
aList.emplace_back( _( "Track Segments" ), wxString::Format( "%d", trackSegmentCount ) );
txt.Printf( wxT( "%d" ), board->GetNodesCount() ); aList.emplace_back( _( "Nets" ), wxString::Format( "%d", (int) netCodes.size() ) );
aList.emplace_back( _( "Nodes" ), txt ); aList.emplace_back( _( "Unrouted" ), wxString::Format( "%d", unconnected ) );
txt.Printf( wxT( "%d" ), board->GetNetCount() - 1 /* don't include "No Net" in count */ );
aList.emplace_back( _( "Nets" ), txt );
txt.Printf( wxT( "%d" ), board->GetConnectivity()->GetUnconnectedCount() );
aList.emplace_back( _( "Unrouted" ), txt );
} }