Fixed sheet-selection code

Fixes: lp:1704644
* https://bugs.launchpad.net/kicad/+bug/1704644
This commit is contained in:
Kristoffer Ödmark 2017-07-16 13:39:30 +02:00 committed by Maciej Suminski
parent ed66496242
commit 4c94d02c42
1 changed files with 19 additions and 13 deletions

View File

@ -915,15 +915,19 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
// now we need to find all modules that are connected to each of these nets
// then we need to determine if these modules are in the list of modules
// belonging to this sheet ( modList )
//RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
std::list<int> removeCodeList;
KICAD_T padType[] = { PCB_PAD_T };
for( int netCode : netcodeList )
{
std::list<BOARD_CONNECTED_ITEM*> netPads;
// fixme
// ratsnest->GetNetItems( netCode, netPads, (RN_ITEM_TYPE)( RN_PADS ) );
for( BOARD_CONNECTED_ITEM* mitem : netPads )
for( BOARD_CONNECTED_ITEM* mitem : board()->GetConnectivity()->GetNetItems( netCode, padType ) )
{
if( mitem->Type() == PCB_PAD_T)
{
/* std::cout << "Checking net " << netCode << "of type " << mitem->Type() << ": "; */
bool found = ( std::find( modList.begin(), modList.end(), mitem->GetParent() ) != modList.end() );
if( !found )
{
@ -935,6 +939,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
}
}
}
}
// remove all duplicates
removeCodeList.sort();
@ -949,9 +954,10 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
for( int netCode : netcodeList )
{
KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
for( auto item : board()->GetConnectivity()->GetNetItems( netCode, types ) )
for( BOARD_CONNECTED_ITEM* item : board()->GetConnectivity()->GetNetItems( netCode, types ) )
{
localConnectionList.push_back( item );
std::cout << netCode << std::endl;
}
}