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,23 +915,28 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
// now we need to find all modules that are connected to each of these nets // 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 // then we need to determine if these modules are in the list of modules
// belonging to this sheet ( modList ) // belonging to this sheet ( modList )
//RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
std::list<int> removeCodeList; std::list<int> removeCodeList;
KICAD_T padType[] = { PCB_PAD_T };
for( int netCode : netcodeList ) for( int netCode : netcodeList )
{ {
std::list<BOARD_CONNECTED_ITEM*> netPads;
// fixme for( BOARD_CONNECTED_ITEM* mitem : board()->GetConnectivity()->GetNetItems( netCode, padType ) )
// ratsnest->GetNetItems( netCode, netPads, (RN_ITEM_TYPE)( RN_PADS ) );
for( BOARD_CONNECTED_ITEM* mitem : netPads )
{ {
bool found = ( std::find( modList.begin(), modList.end(), mitem->GetParent() ) != modList.end() ); if( mitem->Type() == PCB_PAD_T)
if( !found )
{ {
// if we cannot find the module of the pad in the modList
// then we can assume that that module is not located in the same /* std::cout << "Checking net " << netCode << "of type " << mitem->Type() << ": "; */
// schematic, therefore invalidate this netcode. bool found = ( std::find( modList.begin(), modList.end(), mitem->GetParent() ) != modList.end() );
removeCodeList.push_back( netCode ); if( !found )
break; {
// if we cannot find the module of the pad in the modList
// then we can assume that that module is not located in the same
// schematic, therefore invalidate this netcode.
removeCodeList.push_back( netCode );
break;
}
} }
} }
} }
@ -949,9 +954,10 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
for( int netCode : netcodeList ) for( int netCode : netcodeList )
{ {
KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT }; 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 ); localConnectionList.push_back( item );
std::cout << netCode << std::endl;
} }
} }