本文整理汇总了C++中SCH_LINE::IsNew方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_LINE::IsNew方法的具体用法?C++ SCH_LINE::IsNew怎么用?C++ SCH_LINE::IsNew使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCH_LINE
的用法示例。
在下文中一共展示了SCH_LINE::IsNew方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndSegment
void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
{
SCH_SCREEN* screen = GetScreen();
SCH_LINE* segment = (SCH_LINE*) screen->GetCurItem();
if( segment == NULL || segment->Type() != SCH_LINE_T || !segment->IsNew() )
return;
// Delete zero length segments and clear item flags.
SCH_ITEM* item = s_wires.begin();
while( item )
{
item->ClearFlags();
wxCHECK_RET( item->Type() == SCH_LINE_T, wxT( "Unexpected object type in wire list." ) );
segment = (SCH_LINE*) item;
item = item->Next();
if( segment->IsNull() )
delete s_wires.Remove( segment );
}
if( s_wires.GetCount() == 0 )
return;
// Get the last non-null wire (this is the last created segment).
SetRepeatItem( segment = (SCH_LINE*) s_wires.GetLast() );
screen->SetCurItem( NULL );
m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false );
// store the terminal point of this last segment: a junction could be needed
// (the last wire could be merged/deleted/modified, and lost)
wxPoint endpoint = segment->GetEndPoint();
// store the starting point of this first segment: a junction could be needed
SCH_LINE* firstsegment = (SCH_LINE*) s_wires.GetFirst();
wxPoint startPoint = firstsegment->GetStartPoint();
// Save the old wires for the undo command
DLIST< SCH_ITEM > oldWires; // stores here the old wires
GetScreen()->ExtractWires( oldWires, true ); // Save them in oldWires list
// Put the snap shot of the previous wire, buses, and junctions in the undo/redo list.
PICKED_ITEMS_LIST oldItems;
oldItems.m_Status = UR_WIRE_IMAGE;
while( oldWires.GetCount() != 0 )
{
ITEM_PICKER picker = ITEM_PICKER( oldWires.PopFront(), UR_WIRE_IMAGE );
oldItems.PushItem( picker );
}
SaveCopyInUndoList( oldItems, UR_WIRE_IMAGE );
// Remove segments backtracking over others
RemoveBacktracks( s_wires );
// Add the new wires
screen->Append( s_wires );
// Correct and remove segments that need to be merged.
screen->SchematicCleanUp();
// A junction could be needed to connect the end point of the last created segment.
if( screen->IsJunctionNeeded( endpoint ) )
screen->Append( AddJunction( DC, endpoint ) );
// A junction could be needed to connect the start point of the set of new created wires
if( screen->IsJunctionNeeded( startPoint ) )
screen->Append( AddJunction( DC, startPoint ) );
m_canvas->Refresh();
OnModify();
}