int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent ) { if( !selectCursor( true ) ) return 0; auto item = dynamic_cast<BOARD_CONNECTED_ITEM*> ( m_selection.Front() ); if( !item ) return 0; std::list<BOARD_CONNECTED_ITEM*> itemsList; RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest(); int netCode = item->GetNetCode(); clearSelection(); ratsnest->GetNetItems( netCode, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) ); for( BOARD_CONNECTED_ITEM* i : itemsList ) select( i ); // Inform other potentially interested tools if( itemsList.size() > 0 ) m_toolMgr->ProcessEvent( SelectedEvent ); return 0; }
int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent ) { std::list<BOARD_CONNECTED_ITEM*> itemsList; RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest(); BOARD_CONNECTED_ITEM* item = m_selection.Item<BOARD_CONNECTED_ITEM>( 0 ); int netCode = item->GetNetCode(); clearSelection(); ratsnest->GetNetItems( netCode, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) ); BOOST_FOREACH( BOARD_CONNECTED_ITEM* i, itemsList ) select( i ); // Inform other potentially interested tools if( itemsList.size() > 0 ) { TOOL_EVENT selectEvent( SelectedEvent ); m_toolMgr->ProcessEvent( selectEvent ); } return 0; }