48 std::vector<wxString> tests = {
64 for(
const wxString&
test : tests )
68 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
72 for(
size_t ii = 0; ii <
path.size(); ++ii )
76 std::vector<SCH_ITEM*> items;
80 if( !item->IsConnectable() )
89 items.push_back(
pin );
94 items.push_back( item );
100 const std::vector<SCH_ITEM*>& conn_items = item->ConnectedItems(
path );
102 wxString netname = conn ? conn->
GetNetName().ToStdString() : wxString(
"NoNet" );
106 <<
": Item " << item->GetFriendlyName().ToStdString()
107 <<
" in net " << netname.ToStdString() <<
" subgraph " << subgraph
108 <<
" has " << conn_items.size() <<
" connections" );
113 if( !item->IsConnectable() )
116 std::vector<SCH_ITEM*> prev_items = item->ConnectedItems(
path );
117 std::sort( prev_items.begin(), prev_items.end() );
120 std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> all_items =
121 m_schematic->ConnectionGraph()->ExtractAffectedItems( { item } );
122 all_items.insert( {
path, item } );
124 <<
": Item " << item->GetFriendlyName().ToStdString()
125 <<
" in net " << netname.ToStdString()
126 <<
" has " << all_items.size() <<
" affected items" );
130 new_graph.
SetLastCodes( m_schematic->ConnectionGraph() );
132 for(
auto&[ apath, aitem ] : all_items )
134 wxCHECK2( aitem,
continue );
135 aitem->SetConnectivityDirty();
139 m_schematic->ConnectionGraph()->Merge( new_graph );
141 std::vector<SCH_ITEM*> curr_items = item->ConnectedItems(
path );
142 std::sort( curr_items.begin(), curr_items.end() );
145 BOOST_CHECK_MESSAGE( prev_items == curr_items,
147 <<
": Item " << item->GetFriendlyName().ToStdString()
148 <<
" in net " << netname.ToStdString()
149 <<
" changed from " << prev_items.size() <<
" to " << curr_items.size()
150 <<
" Location:" << item->GetPosition().x <<
"," << item->GetPosition().y );
172 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
174 std::map<SCH_SCREEN*, int> instanceCount;
177 instanceCount[
path.LastScreen()]++;
186 for(
const auto& [key, subgraphs] : graph->
GetNetMap() )
190 if( sg->GetItems().count( aItem ) )
202 for(
auto& [screen, count] : instanceCount )
216 if( countRefs(
pin ) >= 2 )
232 BOOST_REQUIRE_MESSAGE( symbol && victim,
"No shared-sheet pin registered on multiple paths" );
234 wxString pinNumber = victim->
GetNumber();
235 std::vector<SCH_PIN*> doomedPins = symbol->
GetPinsByNumber( pinNumber );
239 std::vector<SCH_ITEM*> danglingCandidates( doomedPins.begin(), doomedPins.end() );
245 for(
SCH_PIN* libPin : updated->GetPinsByNumber( pinNumber ) )
246 updated->RemoveDrawItem( libPin );
254 for(
SCH_ITEM* freedPin : danglingCandidates )
256 BOOST_CHECK_MESSAGE( countRefs( freedPin ) == 0,
257 "Freed pin " << pinNumber.ToStdString()
258 <<
" still referenced by a retained subgraph" );
Calculate the connectivity of a schematic and generates netlists.
const NET_MAP & GetNetMap() const
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Update the connection graph for the given list of sheets.
void SetLastCodes(const CONNECTION_GRAPH *aOther)
A subgraph is a set of items that are electrically connected on a single sheet.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString GetNetName() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
const wxString & GetNumber() const
EE_RTREE & Items()
Get the full RTree, usually for iterating.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_SCREEN * GetScreen() const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::vector< SCH_PIN * > GetPinsByNumber(const wxString &aNumber) const
Find all symbol pins with the given number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
void remove_duplicates(_Container &__c)
Deletes all duplicate values from __c.
std::vector< FAB_LAYER_COLOR > dummy
SETTINGS_MANAGER m_settingsManager
CONNECTIVITY_TEST_FIXTURE()
std::unique_ptr< SCHEMATIC > m_schematic
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_FIXTURE_TEST_CASE(RemoveAddItems, CONNECTIVITY_TEST_FIXTURE)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")