From b6d7bc36d05add6a84deaa562c7fff89064917a5 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 20 May 2020 18:50:09 -0400 Subject: [PATCH] Ensure component bounding boxes are correct This was causing junctions to not always be added on wire segments that overlapped component pins, because the pin might not be part of the component bounding box before UpdateLocalLibSymbolLinks() is called. When the bbox was never updated, these symbols weren't collected by the rtree query for objects overlapping a point. --- eeschema/sch_screen.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index b6def971f2..95862fb0eb 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -746,9 +746,15 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter ) void SCH_SCREEN::UpdateLocalLibSymbolLinks() { + std::vector symbols; + for( auto item : Items().OfType( SCH_COMPONENT_T ) ) + symbols.push_back( static_cast( item ) ); + + for( auto symbol : symbols ) { - SCH_COMPONENT* symbol = static_cast( item ); + // Changing the symbol may adjust the bbox of the symbol; remove and reinsert it afterwards. + m_rtree.remove( symbol ); auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() ); @@ -758,6 +764,8 @@ void SCH_SCREEN::UpdateLocalLibSymbolLinks() libSymbol = new LIB_PART( *it->second ); symbol->SetLibSymbol( libSymbol ); + + m_rtree.insert( symbol ); } }