本文整理汇总了C++中SCH_ITEM::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_ITEM::Clone方法的具体用法?C++ SCH_ITEM::Clone怎么用?C++ SCH_ITEM::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCH_ITEM
的用法示例。
在下文中一共展示了SCH_ITEM::Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractWires
void SCH_SCREEN::ExtractWires( DLIST< SCH_ITEM >& aList, bool aCreateCopy )
{
SCH_ITEM* item;
SCH_ITEM* next_item;
for( item = m_drawList.begin(); item; item = next_item )
{
next_item = item->Next();
switch( item->Type() )
{
case SCH_JUNCTION_T:
case SCH_LINE_T:
m_drawList.Remove( item );
aList.Append( item );
if( aCreateCopy )
m_drawList.Insert( (SCH_ITEM*) item->Clone(), next_item );
break;
default:
break;
}
}
}
示例2: RepeatDrawItem
void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
{
SCH_ITEM* repeater = GetRepeatItem();
if( !repeater )
return;
//D( repeater>Show( 0, std::cout ); )
// clone the repeater, move it, insert into display list, then save a copy
// via SetRepeatItem();
SCH_ITEM* my_clone = (SCH_ITEM*) repeater->Clone();
// If cloning a component then put into 'move' mode.
if( my_clone->Type() == SCH_COMPONENT_T )
{
wxPoint pos = GetCrossHairPosition() -
( (SCH_COMPONENT*) my_clone )->GetPosition();
my_clone->SetFlags( IS_NEW );
( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
my_clone->Move( pos );
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( my_clone, DC );
}
else
{
my_clone->Move( GetRepeatStep() );
if( my_clone->CanIncrementLabel() )
( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() );
GetScreen()->Append( my_clone );
if( my_clone->IsConnectable() )
{
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
}
else
{
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
SaveCopyInUndoList( my_clone, UR_NEW );
my_clone->ClearFlags();
}
// clone my_clone, now that it has been moved, thus saving new position.
SetRepeatItem( my_clone );
}
示例3: SetRepeatItem
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
{
// we cannot store a pointer to an item in the display list here since
// that item may be deleted, such as part of a line concatonation or other.
// So simply always keep a copy of the object which is to be repeated.
SCH_ITEM* old = m_item_to_repeat;
SCH_ITEM* cur = aItem;
if( cur != old )
{
if( cur )
{
aItem = (SCH_ITEM*) cur->Clone();
// Clone() preserves the flags, we want 'em cleared.
aItem->ClearFlags();
}
m_item_to_repeat = aItem;
delete old;
}
}