Fix null graph in some connections
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4747
This commit is contained in:
parent
e91b7cf18f
commit
8a0277eb2e
|
@ -305,10 +305,7 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections()
|
||||||
SCH_CONNECTION* item_conn = item->Connection( m_sheet );
|
SCH_CONNECTION* item_conn = item->Connection( m_sheet );
|
||||||
|
|
||||||
if( !item_conn )
|
if( !item_conn )
|
||||||
{
|
item_conn = item->InitializeConnection( m_sheet, m_graph );
|
||||||
item_conn = item->InitializeConnection( m_sheet );
|
|
||||||
item_conn->SetGraph( m_graph );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) ||
|
if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) ||
|
||||||
( m_driver_connection->IsNet() && item_conn->IsBus() ) )
|
( m_driver_connection->IsNet() && item_conn->IsBus() ) )
|
||||||
|
@ -444,7 +441,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||||
{
|
{
|
||||||
if( !pin->Connection( aSheet ) )
|
if( !pin->Connection( aSheet ) )
|
||||||
pin->InitializeConnection( aSheet )->SetGraph( this );
|
pin->InitializeConnection( aSheet, this );
|
||||||
|
|
||||||
pin->ConnectedItems( aSheet ).clear();
|
pin->ConnectedItems( aSheet ).clear();
|
||||||
pin->Connection( aSheet )->Reset();
|
pin->Connection( aSheet )->Reset();
|
||||||
|
@ -466,7 +463,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||||
|
|
||||||
for( SCH_PIN* pin : component->GetSchPins( &aSheet ) )
|
for( SCH_PIN* pin : component->GetSchPins( &aSheet ) )
|
||||||
{
|
{
|
||||||
pin->InitializeConnection( aSheet )->SetGraph( this );
|
pin->InitializeConnection( aSheet, this );
|
||||||
|
|
||||||
wxPoint pos = pin->GetPosition();
|
wxPoint pos = pin->GetPosition();
|
||||||
|
|
||||||
|
@ -486,8 +483,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_items.insert( item );
|
m_items.insert( item );
|
||||||
auto conn = item->InitializeConnection( aSheet );
|
auto conn = item->InitializeConnection( aSheet, this );
|
||||||
conn->SetGraph( this );
|
|
||||||
|
|
||||||
// Set bus/net property here so that the propagation code uses it
|
// Set bus/net property here so that the propagation code uses it
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -688,10 +684,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
auto* conn = aItem->Connection( sheet );
|
auto* conn = aItem->Connection( sheet );
|
||||||
|
|
||||||
if( !conn )
|
if( !conn )
|
||||||
{
|
conn = aItem->InitializeConnection( sheet, this );
|
||||||
conn = aItem->InitializeConnection( sheet );
|
|
||||||
conn->SetGraph( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( conn->SubgraphCode() == 0 );
|
return ( conn->SubgraphCode() == 0 );
|
||||||
};
|
};
|
||||||
|
@ -936,10 +929,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
SCH_CONNECTION* connection = pin->Connection( sheet );
|
SCH_CONNECTION* connection = pin->Connection( sheet );
|
||||||
|
|
||||||
if( !connection )
|
if( !connection )
|
||||||
{
|
connection = pin->InitializeConnection( sheet, this );
|
||||||
connection = pin->InitializeConnection( sheet );
|
|
||||||
connection->SetGraph( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this pin already has a subgraph, don't need to process
|
// If this pin already has a subgraph, don't need to process
|
||||||
if( connection->SubgraphCode() > 0 )
|
if( connection->SubgraphCode() > 0 )
|
||||||
|
|
|
@ -167,6 +167,7 @@ void SCH_CONNECTION::ConfigureFromLabel( const wxString& aLabel )
|
||||||
{
|
{
|
||||||
auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet );
|
auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet );
|
||||||
member->SetPrefix( prefix );
|
member->SetPrefix( prefix );
|
||||||
|
member->SetGraph( m_graph );
|
||||||
member->ConfigureFromLabel( alias_member );
|
member->ConfigureFromLabel( alias_member );
|
||||||
m_members.push_back( member );
|
m_members.push_back( member );
|
||||||
}
|
}
|
||||||
|
@ -175,6 +176,7 @@ void SCH_CONNECTION::ConfigureFromLabel( const wxString& aLabel )
|
||||||
{
|
{
|
||||||
auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet );
|
auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet );
|
||||||
member->SetPrefix( prefix );
|
member->SetPrefix( prefix );
|
||||||
|
member->SetGraph( m_graph );
|
||||||
member->ConfigureFromLabel( group_member );
|
member->ConfigureFromLabel( group_member );
|
||||||
m_members.push_back( member );
|
m_members.push_back( member );
|
||||||
}
|
}
|
||||||
|
@ -764,4 +766,4 @@ bool SCH_CONNECTION::IsMemberOfBus( SCH_CONNECTION* aOther ) const
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,8 @@ void SCH_ITEM::AddConnectionTo( const SCH_SHEET_PATH& aSheet, SCH_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet )
|
SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet,
|
||||||
|
CONNECTION_GRAPH* aGraph )
|
||||||
{
|
{
|
||||||
if( Connection( aSheet ) )
|
if( Connection( aSheet ) )
|
||||||
{
|
{
|
||||||
|
@ -178,6 +179,8 @@ SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet )
|
||||||
auto connection = new SCH_CONNECTION( this );
|
auto connection = new SCH_CONNECTION( this );
|
||||||
connection->SetSheet( aSheet );
|
connection->SetSheet( aSheet );
|
||||||
m_connection_map.insert( std::make_pair( aSheet, connection ) );
|
m_connection_map.insert( std::make_pair( aSheet, connection ) );
|
||||||
|
connection->SetGraph( aGraph );
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
#include <render_settings.h>
|
#include <render_settings.h>
|
||||||
|
|
||||||
|
class CONNECTION_GRAPH;
|
||||||
class SCH_CONNECTION;
|
class SCH_CONNECTION;
|
||||||
class SCH_SHEET_PATH;
|
class SCH_SHEET_PATH;
|
||||||
class SCHEMATIC;
|
class SCHEMATIC;
|
||||||
|
@ -414,7 +415,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aPath is the sheet path to initialize
|
* @param aPath is the sheet path to initialize
|
||||||
*/
|
*/
|
||||||
SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath );
|
SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath, CONNECTION_GRAPH* aGraph );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this item should propagate connection info to aItem
|
* Returns true if this item should propagate connection info to aItem
|
||||||
|
|
Loading…
Reference in New Issue