コード例 #1
0
int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent )
{
    if( !selectCursor( true ) )
        return 0;

    auto item = static_cast<BOARD_CONNECTED_ITEM*> ( m_selection.Front() );
    clearSelection();

    if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
        return 0;

    std::list<BOARD_CONNECTED_ITEM*> itemsList;
    RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();

    ratsnest->GetConnectedItems( item, 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;
}
コード例 #2
0
int SELECTION_TOOL::selectCopper( 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 );

    clearSelection();
    ratsnest->GetConnectedItems( item, 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;
}