本文整理汇总了C++中PICKED_ITEMS_LIST::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ PICKED_ITEMS_LIST::GetCount方法的具体用法?C++ PICKED_ITEMS_LIST::GetCount怎么用?C++ PICKED_ITEMS_LIST::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PICKED_ITEMS_LIST
的用法示例。
在下文中一共展示了PICKED_ITEMS_LIST::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Remove
int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
if( !hoverSelection( selection ) )
return 0;
// Get a copy of the selected items set
PICKED_ITEMS_LIST selectedItems = selection.items;
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
// As we are about to remove items, they have to be removed from the selection first
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
// Save them
for( unsigned int i = 0; i < selectedItems.GetCount(); ++i )
selectedItems.SetPickedItemStatus( UR_DELETED, i );
editFrame->OnModify();
editFrame->SaveCopyInUndoList( selectedItems, UR_DELETED );
// And now remove
for( unsigned int i = 0; i < selectedItems.GetCount(); ++i )
remove( static_cast<BOARD_ITEM*>( selectedItems.GetPickedItem( i ) ) );
getModel<BOARD>()->GetRatsnest()->Recalculate();
return 0;
}
示例2: DuplicateItemsInList
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint& aMoveVector )
{
SCH_ITEM* newitem;
if( aItemsList.GetCount() == 0 )
return;
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
newitem = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
aItemsList.SetPickedItem( newitem, ii );
aItemsList.SetPickedItemStatus( UR_NEW, ii );
{
switch( newitem->Type() )
{
case SCH_JUNCTION_T:
case SCH_LINE_T:
case SCH_BUS_BUS_ENTRY_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_TEXT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_PIN_T:
case SCH_MARKER_T:
case SCH_NO_CONNECT_T:
default:
break;
case SCH_SHEET_T:
{
SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->SetTimeStamp( GetNewTimeStamp() );
break;
}
case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break;
}
SetSchItemParent( newitem, screen );
screen->Append( newitem );
}
}
MoveItemsInList( aItemsList, aMoveVector );
}
示例3: DeleteItemsInList
/**
* Function DeleteItemsInList
* delete schematic items in aItemsList
* deleted items are put in undo list
*/
void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList )
{
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent();
PICKED_ITEMS_LIST itemsList;
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
ITEM_PICKER itemWrapper( item, UR_DELETED );
if( item->Type() == SCH_SHEET_PIN_T )
{
/* this item is depending on a sheet, and is not in global list */
wxMessageBox( wxT( "DeleteItemsInList() err: unexpected SCH_SHEET_PIN_T" ) );
}
else
{
screen->Remove( item );
/* Unlink the structure */
itemsList.PushItem( itemWrapper );
}
}
frame->SaveCopyInUndoList( itemsList, UR_DELETED );
}
示例4: Block_Delete
void PCB_EDIT_FRAME::Block_Delete()
{
OnModify();
SetCurItem( NULL );
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_DELETED;
// unlink items and clear flags
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
itemsList->SetPickedItemStatus( UR_DELETED, ii );
GetBoard()->GetConnectivity()->Remove( item );
switch( item->Type() )
{
case PCB_MODULE_T:
{
MODULE* module = (MODULE*) item;
module->ClearFlags();
module->UnLink();
m_Pcb->m_Status_Pcb = 0;
}
break;
case PCB_ZONE_AREA_T: // a zone area
m_Pcb->Remove( item );
break;
case PCB_LINE_T: // a segment not on copper layers
case PCB_TEXT_T: // a text on a layer
case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer)
case PCB_DIMENSION_T: // a dimension (graphic item)
case PCB_TARGET_T: // a target (graphic item)
item->UnLink();
break;
// These items are deleted, but not put in undo list
case PCB_MARKER_T: // a marker used to show something
case PCB_ZONE_T: // SEG_ZONE items are now deprecated
item->UnLink();
itemsList->RemovePicker( ii );
ii--;
item->DeleteStructure();
break;
default:
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) );
break;
}
}
SaveCopyInUndoList( *itemsList, UR_DELETED );
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
}
示例5: Block_Flip
void PCB_EDIT_FRAME::Block_Flip()
{
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
wxPoint memo;
wxPoint center; // Position of the axis for inversion of all elements
OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_FLIPPED;
memo = GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre();
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
item->Flip( center );
switch( item->Type() )
{
case PCB_MODULE_T:
item->ClearFlags();
m_Pcb->m_Status_Pcb = 0;
break;
// Move and rotate the track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0;
break;
case PCB_ZONE_AREA_T:
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
case PCB_DIMENSION_T:
break;
// This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii );
ii--;
break;
default:
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
break;
}
}
SaveCopyInUndoList( *itemsList, UR_FLIPPED, center );
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
}
示例6: MoveItemsInList
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMoveVector )
{
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
item->Move( aMoveVector );
}
}
示例7: MirrorX
void MirrorX( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMirrorPoint )
{
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
item->MirrorX( aMirrorPoint.y ); // Place it in its new position.
item->ClearFlags();
}
}
示例8: RotateListOfItems
void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, const wxPoint& rotationPoint )
{
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
item->Rotate( rotationPoint ); // Place it in its new position.
item->ClearFlags();
}
}
示例9: Delete_Drawings_All_Layer
void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_ID aLayer )
{
if( IsCopperLayer( aLayer ) )
{
DisplayError( this, _( "Copper layer global delete not allowed!" ) );
return;
}
wxString msg = wxString::Format(
_( "Delete everything on layer %s?" ),
GetChars( GetBoard()->GetLayerName( aLayer ) ) );
if( !IsOK( this, msg ) )
return;
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( NULL, UR_DELETED );
BOARD_ITEM* PtNext;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext )
{
PtNext = item->Next();
switch( item->Type() )
{
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_DIMENSION_T:
case PCB_TARGET_T:
if( item->GetLayer() == aLayer )
{
item->UnLink();
picker.SetItem( item );
pickList.PushItem( picker );
}
break;
default:
{
wxString msg;
msg.Printf( wxT("Delete_Drawings_All_Layer() error: unknown type %d"),
item->Type() );
wxMessageBox( msg );
break;
}
}
}
if( pickList.GetCount() )
{
OnModify();
SaveCopyInUndoList(pickList, UR_DELETED);
}
}
示例10: SaveCopyInUndoList
/*
* Function SaveCopyInUndoList
* Create a copy of the current board item, and put it in the undo list.
*
* aCommandType =
* UR_CHANGED
* UR_NEW
* UR_DELETED
* UR_MOVED
* UR_FLIPPED
* UR_ROTATED
*/
void PCB_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem,
UNDO_REDO_T aCommandType,
const wxPoint& aTransformPoint )
{
if( aItem == NULL ) // Nothing to save
return;
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType );
switch( aCommandType )
{
case UR_CHANGED: // Create a copy of item
if( itemWrapper.GetLink() == NULL ) // When not null, the copy is already done
itemWrapper.SetLink( aItem->Clone() );
commandToUndo->PushItem( itemWrapper );
break;
case UR_NEW:
case UR_DELETED:
#ifdef USE_WX_OVERLAY
m_canvas->Refresh();
#endif
case UR_MOVED:
case UR_FLIPPED:
case UR_ROTATED:
case UR_ROTATED_CLOCKWISE:
commandToUndo->PushItem( itemWrapper );
break;
default:
{
wxString msg;
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), aCommandType );
wxMessageBox( msg );
}
break;
}
if( commandToUndo->GetCount() )
{
/* Save the copy in undo list */
GetScreen()->PushCommandToUndoList( commandToUndo );
/* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
}
else
{
delete commandToUndo;
}
}
示例11: Block_Duplicate
void PCB_EDIT_FRAME::Block_Duplicate( bool aIncrement )
{
wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
PICKED_ITEMS_LIST newList;
newList.m_Status = UR_NEW;
ITEM_PICKER picker( NULL, UR_NEW );
BOARD_ITEM* newitem;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
newitem = (BOARD_ITEM*)item->Clone();
if( aIncrement )
newitem->IncrementItemReference();
if( item->Type() == PCB_MODULE_T )
m_Pcb->m_Status_Pcb = 0;
m_Pcb->Add( newitem );
if( newitem )
{
newitem->Move( MoveVector );
picker.SetItem ( newitem );
newList.PushItem( picker );
}
}
if( newList.GetCount() )
SaveCopyInUndoList( newList, UR_NEW );
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
}
示例12: Block_Move
void PCB_EDIT_FRAME::Block_Move()
{
OnModify();
wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_MOVED;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
itemsList->SetPickedItemStatus( UR_MOVED, ii );
item->Move( MoveVector );
GetBoard()->GetConnectivity()->Update( item );
item->ClearFlags( IS_MOVED );
switch( item->Type() )
{
case PCB_MODULE_T:
m_Pcb->m_Status_Pcb = 0;
item->ClearFlags();
break;
// Move track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like a track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0;
break;
case PCB_ZONE_AREA_T:
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
case PCB_DIMENSION_T:
break;
// This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii );
ii--;
break;
default:
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Move( ) error: unexpected type" ) );
break;
}
}
SaveCopyInUndoList( *itemsList, UR_MOVED, MoveVector );
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
}
示例13: CheckListConnections
void SCH_EDIT_FRAME::CheckListConnections( PICKED_ITEMS_LIST& aItemsList, bool aAppend )
{
std::vector< wxPoint > pts;
std::vector< wxPoint > connections;
GetSchematicConnections( connections );
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
std::vector< wxPoint > new_pts;
if( !item->IsConnectable() )
continue;
item->GetConnectionPoints( new_pts );
pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
// If the item is a line, we also add any connection points from the rest of the schematic
// that terminate on the line after it is moved.
if( item->Type() == SCH_LINE_T )
{
SCH_LINE* line = (SCH_LINE*) item;
for( auto i : connections )
if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), i ) )
pts.push_back( i );
}
else
{
// Clean up any wires that short non-wire connections in the list
for( auto point = new_pts.begin(); point != new_pts.end(); point++ )
{
for( auto second_point = point + 1; second_point != new_pts.end(); second_point++ )
{
aAppend |= TrimWire( *point, *second_point, aAppend );
}
}
}
}
// We always have some overlapping connection points. Drop duplicates here
std::sort( pts.begin(), pts.end(),
[]( const wxPoint& a, const wxPoint& b ) -> bool
{ return a.x < b.x || (a.x == b.x && a.y < b.y); } );
pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
for( auto point : pts )
{
if( GetScreen()->IsJunctionNeeded( point, true ) )
{
AddJunction( point, aAppend );
aAppend = true;
}
}
}
示例14: SaveCopyInUndoList
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
UNDO_REDO_T aCommandType,
const wxPoint& aTransformPoint )
{
/* Does not save a null item or a UR_WIRE_IMAGE command type. UR_WIRE_IMAGE commands
* are handled by the overloaded version of SaveCopyInUndoList that takes a reference
* to a PICKED_ITEMS_LIST.
*/
if( aItem == NULL || aCommandType == UR_WIRE_IMAGE )
return;
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType );
if( aItem )
itemWrapper.SetFlags( aItem->GetFlags() );
switch( aCommandType )
{
case UR_CHANGED: /* Create a copy of item */
itemWrapper.SetLink( DuplicateStruct( aItem, true ) );
commandToUndo->PushItem( itemWrapper );
break;
case UR_NEW:
case UR_DELETED:
case UR_ROTATED:
case UR_MOVED:
commandToUndo->PushItem( itemWrapper );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "SaveCopyInUndoList() error (unknown code %X)" ),
aCommandType ) );
break;
}
if( commandToUndo->GetCount() )
{
/* Save the copy in undo list */
GetScreen()->PushCommandToUndoList( commandToUndo );
/* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
}
else
{
delete commandToUndo;
}
}
示例15: Edit_Track_Width
void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
{
/* Modify a full track (a trace) width (using DRC control).
* a full track is the set of track segments between 2 nodes: pads or a node that has
* more than 2 segments connected
* aDC = the curred device context (can be NULL)
* aTrackSegment = a via or a track belonging to the trace to change
*/
TRACK* pt_track;
int nb_segm;
if( aTrackSegment == NULL )
return;
pt_track = GetBoard()->MarkTrace( GetBoard()->m_Track, aTrackSegment, &nb_segm,
NULL, NULL, true );
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;
for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() )
{
pt_track->SetState( BUSY, false );
if( !SetTrackSegmentWidth( pt_track, &itemsListPicker, false ) )
change = true;
}
if( !change )
return;
// Some segment have changed: redraw them and save in undo list
if( aDC )
{
m_canvas->CrossHairOff( aDC ); // Erase cursor shape
for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ )
{
TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii );
segm->Draw( m_canvas, aDC, GR_XOR ); // Erase old track shape
segm = (TRACK*) itemsListPicker.GetPickedItem( ii );
segm->Draw( m_canvas, aDC, GR_OR ); // Display new track shape
// fixme: commit!
// segm->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
m_canvas->CrossHairOn( aDC ); // Display cursor shape
}
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
}