Cache for netclass pattern assignments.
This commit is contained in:
parent
a1fb8e1b1d
commit
9b9efb9002
|
@ -86,6 +86,8 @@ bool DIALOG_ASSIGN_NETCLASS::TransferDataFromWindow()
|
||||||
m_netclassCtrl->GetStringSelection()
|
m_netclassCtrl->GetStringSelection()
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
netSettings->m_NetClassPatternAssignmentCache.clear();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,6 +411,8 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||||
std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ),
|
std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ),
|
||||||
netclass
|
netclass
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
m_netSettings->m_NetClassPatternAssignmentCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -391,14 +391,22 @@ std::shared_ptr<NETCLASS> NET_SETTINGS::GetEffectiveNetClass( const wxString& aN
|
||||||
if( it != m_NetClassLabelAssignments.end() )
|
if( it != m_NetClassLabelAssignments.end() )
|
||||||
return getNetclass( it->second );
|
return getNetclass( it->second );
|
||||||
|
|
||||||
|
auto it2 = m_NetClassPatternAssignmentCache.find( aNetName );
|
||||||
|
|
||||||
|
if( it2 != m_NetClassPatternAssignmentCache.end() )
|
||||||
|
return getNetclass( it2->second );
|
||||||
|
|
||||||
for( const auto& [ matcher, netclassName ] : m_NetClassPatternAssignments )
|
for( const auto& [ matcher, netclassName ] : m_NetClassPatternAssignments )
|
||||||
{
|
{
|
||||||
int matches;
|
int matches;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
if( matcher->Find( aNetName, matches, offset ) && offset == 0 )
|
if( matcher->Find( aNetName, matches, offset ) && offset == 0 )
|
||||||
|
{
|
||||||
|
m_NetClassPatternAssignmentCache[ aNetName ] = netclassName;
|
||||||
return getNetclass( netclassName );
|
return getNetclass( netclassName );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return m_DefaultNetClass;
|
return m_DefaultNetClass;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
|
|
||||||
std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>
|
std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>
|
||||||
m_NetClassPatternAssignments;
|
m_NetClassPatternAssignments;
|
||||||
|
mutable std::map<wxString, wxString> m_NetClassPatternAssignmentCache;
|
||||||
|
|
||||||
std::map<wxString, wxString> m_NetClassLabelAssignments;
|
std::map<wxString, wxString> m_NetClassLabelAssignments;
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,7 @@ void BOARD::SetProject( PROJECT* aProject, bool aReferenceOnly )
|
||||||
projectSettings->m_NetClasses = legacySettings->m_NetClasses;
|
projectSettings->m_NetClasses = legacySettings->m_NetClasses;
|
||||||
projectSettings->m_NetClassPatternAssignments =
|
projectSettings->m_NetClassPatternAssignments =
|
||||||
std::move( legacySettings->m_NetClassPatternAssignments );
|
std::move( legacySettings->m_NetClassPatternAssignments );
|
||||||
|
projectSettings->m_NetClassPatternAssignmentCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now update the DesignSettings' netclass pointer to point into the project.
|
// Now update the DesignSettings' netclass pointer to point into the project.
|
||||||
|
|
Loading…
Reference in New Issue