本文整理汇总了C++中LIB_PART::RemoveDuplicateDrawItems方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PART::RemoveDuplicateDrawItems方法的具体用法?C++ LIB_PART::RemoveDuplicateDrawItems怎么用?C++ LIB_PART::RemoveDuplicateDrawItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PART
的用法示例。
在下文中一共展示了LIB_PART::RemoveDuplicateDrawItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadOneSymbol
void LIB_EDIT_FRAME::LoadOneSymbol()
{
LIB_PART* part = GetCurPart();
// Exit if no library entry is selected or a command is in progress.
if( !part || ( m_drawItem && m_drawItem->GetFlags() ) )
return;
PROJECT& prj = Prj();
SEARCH_STACK* search = prj.SchSearchS();
m_canvas->SetIgnoreMouseEvents( true );
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
if( !default_path )
default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
wxEmptyString, SchematicSymbolFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
SetCrossHairPosition( wxPoint( 0, 0 ) );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
wxString filename = dlg.GetPath();
prj.SetRString( PROJECT::SCH_LIB_PATH, filename );
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_SYMBOL, filename ) );
wxString err;
if( !lib->Load( err ) )
{
wxString msg = wxString::Format( _(
"Error '%s' occurred loading part file '%s'." ),
GetChars( err ),
GetChars( filename )
);
DisplayError( this, msg );
return;
}
if( lib->IsEmpty() )
{
wxString msg = wxString::Format( _(
"No parts found in part file '%s'." ),
GetChars( filename )
);
DisplayError( this, msg );
return;
}
if( lib->GetCount() > 1 )
{
wxString msg = wxString::Format( _(
"More than one part in part file '%s'." ),
GetChars( filename )
);
wxMessageBox( msg, _( "Warning" ), wxOK | wxICON_EXCLAMATION, this );
}
LIB_PART* first = lib->GetFirstEntry()->GetPart();
LIB_ITEMS& drawList = first->GetDrawItemList();
for( LIB_ITEM& item : drawList )
{
if( item.Type() == LIB_FIELD_T )
continue;
if( item.GetUnit() )
item.SetUnit( m_unit );
if( item.GetConvert() )
item.SetConvert( m_convert );
item.SetFlags( IS_NEW | SELECTED );
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->SetParent( part );
part->AddDrawItem( newItem );
}
part->RemoveDuplicateDrawItems();
part->ClearSelectedItems();
OnModify();
m_canvas->Refresh();
}