本文整理汇总了C++中SCH_ITEM::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_ITEM::GetPosition方法的具体用法?C++ SCH_ITEM::GetPosition怎么用?C++ SCH_ITEM::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCH_ITEM
的用法示例。
在下文中一共展示了SCH_ITEM::GetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTopLeftItem
EDA_ITEM* SELECTION::GetTopLeftItem( bool onlyModules ) const
{
SCH_ITEM* topLeftItem = nullptr;
SCH_ITEM* currentItem;
wxPoint pos;
// find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item in the selection
for( auto item : m_items )
{
currentItem = static_cast<SCH_ITEM*>( item );
pos = currentItem->GetPosition();
if( topLeftItem == nullptr )
topLeftItem = currentItem;
else if( pos.x < topLeftItem->GetPosition().x )
topLeftItem = currentItem;
else if( topLeftItem->GetPosition().x == pos.x && pos.y < topLeftItem->GetPosition().y )
topLeftItem = currentItem;
}
return static_cast<EDA_ITEM*>( topLeftItem );
}
示例2: SchematicCleanUp
bool SCH_SCREEN::SchematicCleanUp()
{
bool modified = false;
for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
{
if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
continue;
bool restart;
for( SCH_ITEM* testItem = item->Next(); testItem; testItem = restart ? m_drawList.begin() : testItem->Next() )
{
restart = false;
if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
{
SCH_LINE* line = (SCH_LINE*) item;
if( line->MergeOverlap( (SCH_LINE*) testItem ) )
{
// Keep the current flags, because the deleted segment can be flagged.
item->SetFlags( testItem->GetFlags() );
DeleteItem( testItem );
restart = true;
modified = true;
}
}
else if ( ( ( item->Type() == SCH_JUNCTION_T )
&& ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
{
if ( testItem->HitTest( item->GetPosition() ) )
{
// Keep the current flags, because the deleted segment can be flagged.
item->SetFlags( testItem->GetFlags() );
DeleteItem( testItem );
restart = true;
modified = true;
}
}
}
}
TestDanglingEnds();
return modified;
}