本文整理汇总了C++中SCH_ITEM::CanConnect方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_ITEM::CanConnect方法的具体用法?C++ SCH_ITEM::CanConnect怎么用?C++ SCH_ITEM::CanConnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCH_ITEM
的用法示例。
在下文中一共展示了SCH_ITEM::CanConnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addConnectedItemsToBlock
void SCH_SCREEN::addConnectedItemsToBlock( const SCH_ITEM* aItem, const wxPoint& position )
{
SCH_ITEM* item;
ITEM_PICKER picker;
for( item = m_drawList.begin(); item; item = item->Next() )
{
if( !item->IsConnectable() || ( item->GetFlags() & SKIP_STRUCT )
|| !item->CanConnect( aItem ) || item == aItem )
continue;
// A line having 2 ends, it can be tested twice: one time per end
if( item->Type() == SCH_LINE_T )
{
SCH_LINE* line = (SCH_LINE*) item;
if( !item->HitTest( position ) )
continue;
// First time through. Flags set to denote an end that is not moving
if( !item->IsSelected() )
item->SetFlags( CANDIDATE | STARTPOINT | ENDPOINT );
if( line->GetStartPoint() == position )
item->ClearFlags( STARTPOINT );
else if( line->GetEndPoint() == position )
item->ClearFlags( ENDPOINT );
else
// This picks up items such as labels that can connect to the middle of a line
item->ClearFlags( STARTPOINT | ENDPOINT );
}
// We want to move a mid-connected label or bus entry when the full line is being moved
else if( !item->IsSelected()
&& aItem->Type() == SCH_LINE_T
&& !( aItem->GetFlags() & ( ENDPOINT | STARTPOINT ) ) )
{
std::vector< wxPoint > connections;
item->GetConnectionPoints( connections );
for( auto conn : connections )
{
if( aItem->HitTest( conn ) )
{
item->SetFlags( CANDIDATE );
break;
}
}
}
if( item->IsSelected() )
continue;
if( ( item->GetFlags() & CANDIDATE ) || item->IsConnected( position ) ) // Deal with all non-line items
{
item->ClearFlags( CANDIDATE );
item->SetFlags( SELECTED );
picker.SetItem( item );
picker.SetFlags( item->GetFlags() );
m_BlockLocate.GetItems().PushItem( picker );
}
}
}