Don't re-add deleted netclass assignments in incremental connectivity

Ensures that if moving or deleting a netclass directive label, the
netclass on the previously-assigned net doesn't have the stale
netclass re-applied.
This commit is contained in:
JamesJCode 2024-06-10 20:19:07 +01:00
parent d40bbed591
commit 0826c10a20
1 changed files with 11 additions and 1 deletions

View File

@ -2369,6 +2369,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
std::shared_ptr<NET_SETTINGS>& netSettings = m_schematic->Prj().GetProjectFile().m_NetSettings;
std::map<wxString, wxString> oldAssignments = netSettings->m_NetClassLabelAssignments;
std::set<wxString> affectedNetclassNetAssignments;
netSettings->m_NetClassLabelAssignments.clear();
@ -2443,10 +2444,16 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
if( oldAssignments.count( netname ) )
{
if( oldAssignments[netname] != netclass )
{
affectedNetclassNetAssignments.insert( netname );
dirtySubgraphs( subgraphs );
}
}
else if( !netclass.IsEmpty() )
{
affectedNetclassNetAssignments.insert( netname );
dirtySubgraphs( subgraphs );
}
};
for( const auto& [ netname, subgraphs ] : m_net_name_to_subgraphs_map )
@ -2456,8 +2463,11 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
{
for( auto& [ netname, netclass ] : oldAssignments )
{
if( netSettings->m_NetClassLabelAssignments.count( netname ) )
if( netSettings->m_NetClassLabelAssignments.count( netname )
|| affectedNetclassNetAssignments.count( netname ) )
{
continue;
}
netSettings->m_NetClassLabelAssignments[ netname ] = netclass;
}