Narrow down collector

RTree keeps track of position as well.  We can use this to reduce the
amount of time spent in the collector routine
This commit is contained in:
Seth Hillbrand 2021-09-13 20:24:07 -07:00
parent 1c409ff90a
commit 4b436fb86d
1 changed files with 7 additions and 5 deletions

View File

@ -152,9 +152,11 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
bool sheetsVisited = false;
bool globalLabelsVisited = false;
for( const KICAD_T* filter = aFilterList; *filter != EOT; ++filter )
EE_RTREE& items = aScreen->Items();
for( const KICAD_T *filter = aFilterList; *filter != EOT; ++filter )
{
for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) )
for( SCH_ITEM *item : items.Overlapping( *filter, aPos, m_Threshold ) )
{
if( *filter == SCH_SYMBOL_T || *filter == SCH_LOCATE_ANY_T )
symbolsVisited = true;
@ -171,19 +173,19 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
if( !symbolsVisited )
{
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
for( SCH_ITEM *item : items.Overlapping( SCH_SYMBOL_T, aPos, m_Threshold ) )
item->Visit( m_inspector, nullptr, m_scanTypes );
}
if( !sheetsVisited )
{
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SHEET_T ) )
for( SCH_ITEM *item : items.Overlapping( SCH_SHEET_T, aPos, m_Threshold ) )
item->Visit( m_inspector, nullptr, m_scanTypes );
}
if( !globalLabelsVisited )
{
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
for( SCH_ITEM *item : items.Overlapping( SCH_GLOBAL_LABEL_T, aPos, m_Threshold ) )
item->Visit( m_inspector, nullptr, m_scanTypes );
}
}