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.
This commit is contained in:
JamesJCode 2024-05-07 20:13:30 +01:00
parent d3f69a11f2
commit 9e1a5eb1bd
2 changed files with 17 additions and 9 deletions

View File

@ -504,14 +504,11 @@ 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
} );
m_netSettings->m_NetClassPatternAssignmentCache.clear();
{ std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ), netclass } );
}
m_netSettings->m_NetClassPatternAssignmentCache.clear();
return true;
}

View File

@ -2405,7 +2405,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() );
@ -2414,9 +2417,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 );
};