Try harder to remove stale pins from connectivity
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16846
This commit is contained in:
parent
24cf0c0c62
commit
4eba781013
|
@ -734,6 +734,14 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
|
||||||
}
|
}
|
||||||
|
|
||||||
alg::delete_matching( m_items, item );
|
alg::delete_matching( m_items, item );
|
||||||
|
|
||||||
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
|
{
|
||||||
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
|
|
||||||
|
for( SCH_PIN* pin : symbol->GetPins( &sg->m_sheet ) )
|
||||||
|
alg::delete_matching( m_items, pin );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSubgraphs( subgraphs );
|
removeSubgraphs( subgraphs );
|
||||||
|
@ -742,6 +750,24 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CONNECTION_GRAPH::RemoveItem( SCH_ITEM* aItem )
|
||||||
|
{
|
||||||
|
auto it = m_item_to_subgraph_map.find( aItem );
|
||||||
|
|
||||||
|
if( it == m_item_to_subgraph_map.end() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
CONNECTION_SUBGRAPH* subgraph = it->second;
|
||||||
|
|
||||||
|
while(subgraph->m_absorbed_by )
|
||||||
|
subgraph = subgraph->m_absorbed_by;
|
||||||
|
|
||||||
|
subgraph->RemoveItem( aItem );
|
||||||
|
alg::delete_matching( m_items, aItem );
|
||||||
|
m_item_to_subgraph_map.erase( it );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CONNECTION_GRAPH::removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgraphs )
|
void CONNECTION_GRAPH::removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgraphs )
|
||||||
{
|
{
|
||||||
std::sort( m_driver_subgraphs.begin(), m_driver_subgraphs.end() );
|
std::sort( m_driver_subgraphs.begin(), m_driver_subgraphs.end() );
|
||||||
|
@ -906,6 +932,9 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
||||||
|
|
||||||
for( SCH_ITEM* item : aItemList )
|
for( SCH_ITEM* item : aItemList )
|
||||||
{
|
{
|
||||||
|
if( item->Type() == SCH_PIN_T )
|
||||||
|
std::cout << "conn updateItemConnectivity " << item << std::endl;
|
||||||
|
|
||||||
std::vector<VECTOR2I> points = item->GetConnectionPoints();
|
std::vector<VECTOR2I> points = item->GetConnectionPoints();
|
||||||
item->ConnectedItems( aSheet ).clear();
|
item->ConnectedItems( aSheet ).clear();
|
||||||
|
|
||||||
|
|
|
@ -452,6 +452,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void Merge( CONNECTION_GRAPH& aGraph );
|
void Merge( CONNECTION_GRAPH& aGraph );
|
||||||
|
|
||||||
|
void RemoveItem( SCH_ITEM* aItem );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Update the graphical connectivity between items (i.e. where they touch)
|
* Update the graphical connectivity between items (i.e. where they touch)
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <sch_commit.h>
|
#include <sch_commit.h>
|
||||||
|
#include <connection_graph.h>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
@ -533,6 +534,14 @@ void SCH_COMMIT::Revert()
|
||||||
{
|
{
|
||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
symbol->UpdatePins();
|
symbol->UpdatePins();
|
||||||
|
|
||||||
|
CONNECTION_GRAPH* graph = schematic->ConnectionGraph();
|
||||||
|
|
||||||
|
SCH_SYMBOL* symbolCopy = static_cast<SCH_SYMBOL*>( copy );
|
||||||
|
graph->RemoveItem( symbolCopy );
|
||||||
|
|
||||||
|
for( SCH_PIN* pin : symbolCopy->GetPins() )
|
||||||
|
graph->RemoveItem( pin );
|
||||||
}
|
}
|
||||||
|
|
||||||
item->SetConnectivityDirty();
|
item->SetConnectivityDirty();
|
||||||
|
|
Loading…
Reference in New Issue