Improve performance of schematic load and connectivity
Store component paths and references efficiently Remove redundant calls to RecalculateConnections
This commit is contained in:
parent
262283995c
commit
2eaefb4874
|
@ -407,10 +407,12 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
RescueSymbolLibTableProject( false );
|
RescueSymbolLibTableProject( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_ConnectionGraph->Reset();
|
||||||
|
|
||||||
|
// Update all symbol library links for all sheets.
|
||||||
|
// NOTE: calls RecalculateConnections( GLOBAL_CLEANUP )
|
||||||
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
||||||
|
|
||||||
g_ConnectionGraph->Reset();
|
|
||||||
RecalculateConnections( GLOBAL_CLEANUP );
|
|
||||||
SetScreen( g_CurrentSheet->LastScreen() );
|
SetScreen( g_CurrentSheet->LastScreen() );
|
||||||
|
|
||||||
// Migrate conflicting bus definitions
|
// Migrate conflicting bus definitions
|
||||||
|
@ -419,13 +421,11 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
{
|
{
|
||||||
DIALOG_MIGRATE_BUSES dlg( this );
|
DIALOG_MIGRATE_BUSES dlg( this );
|
||||||
dlg.ShowQuasiModal();
|
dlg.ShowQuasiModal();
|
||||||
|
RecalculateConnections( NO_CLEANUP );
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->TestDanglingEnds(); // Only perform the dangling end test on root sheet.
|
GetScreen()->TestDanglingEnds(); // Only perform the dangling end test on root sheet.
|
||||||
RecalculateConnections( GLOBAL_CLEANUP );
|
|
||||||
|
|
||||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||||
|
|
||||||
GetScreen()->m_Initialized = true;
|
GetScreen()->m_Initialized = true;
|
||||||
|
@ -720,7 +720,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
}
|
}
|
||||||
// Only perform the dangling end test on root sheet.
|
// Only perform the dangling end test on root sheet.
|
||||||
GetScreen()->TestDanglingEnds();
|
GetScreen()->TestDanglingEnds();
|
||||||
RecalculateConnections( GLOBAL_CLEANUP );
|
|
||||||
|
|
||||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ public:
|
||||||
* Do nothing if already exists.
|
* Do nothing if already exists.
|
||||||
* In component lists shared by more than one sheet path, an entry for each
|
* In component lists shared by more than one sheet path, an entry for each
|
||||||
* sheet path must exist to manage references
|
* sheet path must exist to manage references
|
||||||
* @param aSheetPathName is the candidate sheet path name
|
* @param aSheetPath is the candidate sheet path
|
||||||
* this sheet path is the sheet path of the sheet containing the component,
|
* this sheet path is the sheet path of the sheet containing the component,
|
||||||
* not the full component sheet path
|
* not the full component sheet path
|
||||||
* @return false if the alternate reference was existing, true if added.
|
* @return false if the alternate reference was existing, true if added.
|
||||||
|
|
|
@ -390,7 +390,9 @@ void SCH_CONNECTION::AppendDebugInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
|
||||||
|
|
||||||
bool SCH_CONNECTION::IsBusLabel( const wxString& aLabel )
|
bool SCH_CONNECTION::IsBusLabel( const wxString& aLabel )
|
||||||
{
|
{
|
||||||
return IsBusVectorLabel( aLabel ) || IsBusGroupLabel( aLabel );
|
//return IsBusVectorLabel( aLabel ) || IsBusGroupLabel( aLabel );
|
||||||
|
// Weak heuristic for performance reasons. Stronger test will be used for connectivity
|
||||||
|
return aLabel.Contains( wxT( "[" ) ) || aLabel.Contains( wxT( "{" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1169,6 +1169,8 @@ void SCH_EDIT_FRAME::FixupJunctions()
|
||||||
// Save the current sheet, to retrieve it later
|
// Save the current sheet, to retrieve it later
|
||||||
auto currSheet = GetCurrentSheet();
|
auto currSheet = GetCurrentSheet();
|
||||||
|
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
SCH_SHEET_LIST sheetList;
|
SCH_SHEET_LIST sheetList;
|
||||||
sheetList.BuildSheetList( g_RootSheet );
|
sheetList.BuildSheetList( g_RootSheet );
|
||||||
|
|
||||||
|
@ -1197,9 +1199,15 @@ void SCH_EDIT_FRAME::FixupJunctions()
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto& pos : junctions )
|
for( auto& pos : junctions )
|
||||||
AddJunction( pos );
|
AddJunction( pos, false, false );
|
||||||
|
|
||||||
|
if( junctions.size() )
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( modified )
|
||||||
|
OnModify();
|
||||||
|
|
||||||
// Reselect the initial sheet:
|
// Reselect the initial sheet:
|
||||||
SetCurrentSheet( currSheet );
|
SetCurrentSheet( currSheet );
|
||||||
GetCurrentSheet().UpdateAllScreenReferences();
|
GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
|
|
|
@ -1985,7 +1985,6 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
|
||||||
{
|
{
|
||||||
std::string name1;
|
std::string name1;
|
||||||
std::string name2;
|
std::string name2;
|
||||||
wxArrayString reference_fields;
|
|
||||||
|
|
||||||
static wxString delimiters( wxT( " " ) );
|
static wxString delimiters( wxT( " " ) );
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,7 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
||||||
|
|
||||||
void SCH_SCREEN::EnsureAlternateReferencesExist()
|
void SCH_SCREEN::EnsureAlternateReferencesExist()
|
||||||
{
|
{
|
||||||
if( GetClientSheetPathsCount() <= 1 ) // No need for alternate reference
|
if( GetClientSheetPaths().size() <= 1 ) // No need for alternate reference
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||||
|
@ -753,8 +753,8 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
|
||||||
auto component = static_cast<SCH_COMPONENT*>( item );
|
auto component = static_cast<SCH_COMPONENT*>( item );
|
||||||
|
|
||||||
// Add (when not existing) all sheet path entries
|
// Add (when not existing) all sheet path entries
|
||||||
for( unsigned int ii = 0; ii < m_clientSheetPathList.GetCount(); ii++ )
|
for( const auto& sheet : GetClientSheetPaths() )
|
||||||
component->AddSheetPathReferenceEntryIfMissing( m_clientSheetPathList[ii] );
|
component->AddSheetPathReferenceEntryIfMissing( sheet.Path() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1299,7 +1299,7 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
||||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||||
|
|
||||||
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
||||||
curr_screen->GetClientSheetPaths().Clear();
|
curr_screen->GetClientSheetPaths().clear();
|
||||||
|
|
||||||
for( SCH_SHEET_PATH& sheetpath: sheetList )
|
for( SCH_SHEET_PATH& sheetpath: sheetList )
|
||||||
{
|
{
|
||||||
|
@ -1310,7 +1310,7 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
||||||
{
|
{
|
||||||
if( used_screen == curr_screen )
|
if( used_screen == curr_screen )
|
||||||
{
|
{
|
||||||
curr_screen->GetClientSheetPaths().Add( sheetpath.PathAsString() );
|
curr_screen->GetClientSheetPaths().push_back( sheetpath );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ private:
|
||||||
* can have many scheet paths sharing this screen, if this sheet is inside
|
* can have many scheet paths sharing this screen, if this sheet is inside
|
||||||
* an other sheet having many instances (one sheet path by parent sheet instance).
|
* an other sheet having many instances (one sheet path by parent sheet instance).
|
||||||
*/
|
*/
|
||||||
wxArrayString m_clientSheetPathList;
|
std::vector<SCH_SHEET_PATH> m_clientSheetPathList;
|
||||||
|
|
||||||
/// The size of the paper to print or plot on
|
/// The size of the paper to print or plot on
|
||||||
PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
|
PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
|
||||||
|
@ -170,16 +170,16 @@ public:
|
||||||
int GetRefCount() const { return m_refCount; }
|
int GetRefCount() const { return m_refCount; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the sheet paths count sharing this screen
|
* @return the sheet paths sharing this screen
|
||||||
* if 1 this screen is not in a complex hierarchy: the reference field can be
|
* if 1 this screen is not in a complex hierarchy: the reference field can be
|
||||||
* used to store the component reference
|
* used to store the component reference
|
||||||
* if > 1 this screen is in a complex hierarchy, and components must have
|
* if > 1 this screen is in a complex hierarchy, and components must have
|
||||||
* a full alternate reference management
|
* a full alternate reference management
|
||||||
*/
|
*/
|
||||||
int GetClientSheetPathsCount() { return (int) m_clientSheetPathList.GetCount(); }
|
std::vector<SCH_SHEET_PATH>& GetClientSheetPaths()
|
||||||
|
{
|
||||||
wxArrayString& GetClientSheetPaths() { return m_clientSheetPathList; }
|
return m_clientSheetPathList;
|
||||||
|
}
|
||||||
|
|
||||||
void Append( SCH_ITEM* aItem );
|
void Append( SCH_ITEM* aItem );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue