Added type filtering for CONNECTIVITY_DATA::GetNetItems()

This commit is contained in:
Maciej Suminski 2017-07-17 10:19:36 +02:00
parent 4c94d02c42
commit 8dd36b4d2b
1 changed files with 16 additions and 4 deletions

View File

@ -344,11 +344,23 @@ const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetC
std::set<BOARD_CONNECTED_ITEM*> items;
std::list<BOARD_CONNECTED_ITEM*> rv;
// fixme: apply aTypes
m_connAlgo->ForEachItem( [&items, aNetCode] ( CN_ITEM* aItem ) {
m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM* aItem )
{
if( aItem->Net() == aNetCode )
{
KICAD_T itemType = aItem->Parent()->Type();
for( int i = 0; aTypes[i] > 0; ++i )
{
wxASSERT( aTypes[i] < MAX_STRUCT_TYPE_ID );
if( itemType == aTypes[i] )
{
items.insert( aItem->Parent() );
break;
}
}
}
} );
std::copy( items.begin(), items.end(), std::front_inserter( rv ) );