Eeschema: Only assign nets with resolved netclasses to the label map

Also fixes a bug where the pattern assignment cache was not cleared
if all pattern assignments were deleted in the setup netclasses
panel.

Cherry-picked from 9e1a5eb1bd
This commit is contained in:
JamesJCode 2024-05-07 20:13:30 +01:00
parent f60b76696a
commit 8dbdc3717c
2 changed files with 17 additions and 12 deletions

View File

@ -442,13 +442,10 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
wxString netclass = m_assignmentGrid->GetCellValue( row, 1 );
m_netSettings->m_NetClassPatternAssignments.push_back(
{
std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ),
netclass
} );
{ std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ), netclass } );
}
m_netSettings->m_NetClassPatternAssignmentCache.clear();
}
return true;
}

View File

@ -2375,9 +2375,6 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
}
}
if( netclass.IsEmpty() )
return;
if( !driverSubgraph )
driverSubgraph = subgraphs.front();
@ -2387,7 +2384,10 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
{
for( const auto& member : driverSubgraph->m_driver_connection->Members() )
{
netSettings->m_NetClassLabelAssignments[ member->Name() ] = netclass;
if( netclass.IsEmpty() )
netSettings->m_NetClassLabelAssignments.erase( member->Name() );
else
netSettings->m_NetClassLabelAssignments[member->Name()] = netclass;
auto ii = m_net_name_to_subgraphs_map.find( member->Name() );
@ -2396,9 +2396,17 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
}
}
netSettings->m_NetClassLabelAssignments[ netname ] = netclass;
if( netclass.IsEmpty() )
netSettings->m_NetClassLabelAssignments.erase( netname );
else
netSettings->m_NetClassLabelAssignments[netname] = netclass;
if( oldAssignments[ netname ] != netclass )
if( oldAssignments.count( netname ) )
{
if( oldAssignments[netname] != netclass )
dirtySubgraphs( subgraphs );
}
else if( !netclass.IsEmpty() )
dirtySubgraphs( subgraphs );
};