本文整理汇总了C++中EDA_ITEM类的典型用法代码示例。如果您正苦于以下问题:C++ EDA_ITEM类的具体用法?C++ EDA_ITEM怎么用?C++ EDA_ITEM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDA_ITEM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComponentCount
int SCH_SHEET::ComponentCount()
{
int n = 0;
if( m_screen )
{
EDA_ITEM* bs;
for( bs = m_screen->GetDrawItems(); bs != NULL; bs = bs->Next() )
{
if( bs->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
n++;
}
if( bs->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) bs;
n += sheet->ComponentCount();
}
}
}
return n;
}
示例2: export_vrml_drawings
static void export_vrml_drawings( MODEL_VRML& aModel, BOARD* pcb )
{
// draw graphic items
for( EDA_ITEM* drawing = pcb->m_Drawings; drawing != 0; drawing = drawing->Next() )
{
LAYER_ID layer = ( (DRAWSEGMENT*) drawing )->GetLayer();
if( layer != F_Cu && layer != B_Cu && layer != B_SilkS && layer != F_SilkS )
continue;
switch( drawing->Type() )
{
case PCB_LINE_T:
export_vrml_drawsegment( aModel, (DRAWSEGMENT*) drawing );
break;
case PCB_TEXT_T:
export_vrml_pcbtext( aModel, (TEXTE_PCB*) drawing );
break;
default:
break;
}
}
}
示例3: AnnotatePowerSymbols
void SCH_SHEET_PATH::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
{
int ref = 1;
if( aReference )
ref = *aReference;
for( EDA_ITEM* item = LastDrawList(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );
if( !part || !part->IsPower() )
continue;
wxString refstr = component->GetPrefix();
//str will be "C?" or so after the ClearAnnotation call.
while( refstr.Last() == '?' )
refstr.RemoveLast();
if( !refstr.StartsWith( wxT( "#" ) ) )
refstr = wxT( "#" ) + refstr;
refstr << wxT( "0" ) << ref;
component->SetRef( this, refstr );
ref++;
}
if( aReference )
*aReference = ref;
}
示例4: SearchHierarchy
bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen )
{
if( m_screen )
{
EDA_ITEM* item = m_screen->GetDrawItems();
while( item )
{
if( item->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) item;
if( sheet->m_screen
&& sheet->m_screen->GetFileName().CmpNoCase( aFilename ) == 0 )
{
*aScreen = sheet->m_screen;
return true;
}
if( sheet->SearchHierarchy( aFilename, aScreen ) )
return true;
}
item = item->Next();
}
}
return false;
}
示例5: SaveCopyInUndoList
void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint )
{
EDA_ITEM* item;
MODULE* CopyItem;
PICKED_ITEMS_LIST* lastcmd;
CopyItem = new MODULE( *( (MODULE*) aItem ) );
CopyItem->SetParent( GetBoard() );
lastcmd = new PICKED_ITEMS_LIST();
ITEM_PICKER wrapper( CopyItem, UR_MODEDIT );
lastcmd->PushItem( wrapper );
GetScreen()->PushCommandToUndoList( lastcmd );
/* Clear current flags (which can be temporary set by a current edit command) */
for( item = CopyItem->GraphicalItems(); item != NULL; item = item->Next() )
item->ClearFlags();
for( D_PAD* pad = CopyItem->Pads(); pad; pad = pad->Next() )
pad->ClearFlags();
CopyItem->Reference().ClearFlags();
CopyItem->Value().ClearFlags();
/* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
}
示例6: AddScreenToList
void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{
if( aItem && aItem->Type() == SCH_SHEET_T )
{
SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->GetScreen();
}
if( aItem && aItem->Type() == SCH_SCREEN_T )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems();
while( strct )
{
if( strct->Type() == SCH_SHEET_T )
{
BuildScreenList( strct );
}
strct = strct->Next();
}
}
}
示例7: removeCorner
void POINT_EDITOR::removeCorner( EDIT_POINT* aPoint )
{
EDA_ITEM* item = m_editPoints->GetParent();
if( item->Type() == PCB_ZONE_AREA_T )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
CPolyLine* outline = zone->Outline();
for( int i = 0; i < outline->GetCornersCount(); ++i )
{
if( VECTOR2I( outline->GetPos( i ) ) == aPoint->GetPosition() )
{
frame->OnModify();
frame->SaveCopyInUndoList( selection.items, UR_CHANGED );
outline->DeleteCorner( i );
setEditedPoint( NULL );
break;
}
}
}
}
示例8: while
void SCH_SHEET::CleanupSheet()
{
SCH_SHEET_PINS::iterator i = m_pins.begin();
while( i != m_pins.end() )
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
const SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue;
HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
if( i->GetText().CmpNoCase( HLabel->GetText() ) == 0 )
break; // Found!
HLabel = NULL;
}
if( HLabel == NULL ) // Hlabel not found: delete sheet label.
i = m_pins.erase( i );
else
++i;
}
}
示例9: AddScreenToList
void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{
if( aItem && aItem->Type() == SCH_SHEET_T )
{
SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->GetScreen();
}
if( aItem && aItem->Type() == SCH_SCREEN_T )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
// Ensure each component has its pointer to its part lib LIB_PART
// up to date (the cost is low if this is the case)
// We do this update here, because most of time this function is called
// to create a netlist, or an ERC, which need this update
screen->BuildSchCmpLinksToLibCmp();
AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems();
while( strct )
{
if( strct->Type() == SCH_SHEET_T )
{
BuildScreenList( strct );
}
strct = strct->Next();
}
}
}
示例10: Delete_Segment_Edge
void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
EDA_ITEM* PtStruct;
int track_fill_copy = DisplayOpt.DisplayDrawItems;
if( Segment == NULL )
return;
if( Segment->IsNew() ) // Trace in progress.
{
// Delete current segment.
DisplayOpt.DisplayDrawItems = SKETCH;
Segment->Draw( m_canvas, DC, GR_XOR );
PtStruct = Segment->Back();
Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) )
Segment = (DRAWSEGMENT*) PtStruct;
DisplayOpt.DisplayDrawItems = track_fill_copy;
SetCurItem( NULL );
}
else if( Segment->GetFlags() == 0 )
{
Segment->Draw( m_canvas, DC, GR_XOR );
Segment->ClearFlags();
SaveCopyInUndoList(Segment, UR_DELETED);
Segment->UnLink();
SetCurItem( NULL );
OnModify();
}
}
示例11: wxCHECK_MSG
wxString SCH_FIND_COLLECTOR::GetText()
{
wxCHECK_MSG( (GetCount() != 0) && IsValidIndex( m_foundIndex ), wxEmptyString,
wxT( "Cannot get found item at invalid index." ) );
SCH_FIND_COLLECTOR_DATA data = m_data[ m_foundIndex ];
EDA_ITEM* foundItem = m_List[ m_foundIndex ];
wxCHECK_MSG( foundItem != NULL, wxEmptyString, wxT( "Invalid found item pointer." ) );
wxString msg;
if( data.GetParent() )
{
msg.Printf( _( "Child item %s of parent item %s found in sheet %s" ),
GetChars( foundItem->GetSelectMenuText() ),
GetChars( data.GetParent()->GetSelectMenuText() ),
GetChars( data.GetSheetPath() ) );
}
else
{
msg.Printf( _( "Item %s found in sheet %s" ),
GetChars( foundItem->GetSelectMenuText() ),
GetChars( data.GetSheetPath() ) );
}
return msg;
}
示例12: HasUndefinedPins
bool SCH_SHEET::HasUndefinedPins()
{
for( const SCH_SHEET_PIN& pin : m_pins )
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
const SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
continue;
HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
if( pin.GetText().CmpNoCase( HLabel->GetText() ) == 0 )
break; // Found!
HLabel = NULL;
}
if( HLabel == NULL ) // Corresponding hierarchical label not found.
return true;
}
return false;
}
示例13: LocatePathOfScreen
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
{
if( m_screen )
{
aList->push_back( this );
if( m_screen == aScreen )
return true;
EDA_ITEM* strct = m_screen->GetDrawItems();
while( strct )
{
if( strct->Type() == SCH_SHEET_T )
{
SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->LocatePathOfScreen( aScreen, aList ) )
return true;
}
strct = strct->Next();
}
aList->pop_back();
}
return false;
}
示例14: GetPosition
void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
{
/* Move the reference point of the footprint
* the footprints elements (pads, outlines, edges .. ) are moved
* but:
* - the footprint position is not modified.
* - the relative (local) coordinates of these items are modified
*/
wxPoint footprintPos = GetPosition();
/* Update the relative coordinates:
* The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */
wxPoint moveVector = aMoveVector;
RotatePoint( &moveVector, -GetOrientation() );
// Update of the reference and value.
m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
m_Reference->SetDrawCoord();
m_Value->SetPos0( m_Value->GetPos0() + moveVector );
m_Value->SetDrawCoord();
// Update the pad local coordinates.
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
{
pad->SetPos0( pad->GetPos0() + moveVector );
pad->SetPosition( pad->GetPos0() + footprintPos );
}
// Update the draw element coordinates.
for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->m_Start0 += moveVector;
edge->m_End0 += moveVector;
edge->SetDrawCoord();
break;
}
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetPos0( text->GetPos0() + moveVector );
text->SetDrawCoord();
break;
}
default:
break;
}
}
CalculateBoundingBox();
}
示例15: TransformGraphicTextWithClearanceToPolygonSet
// Same as function TransformGraphicShapesWithClearanceToPolygonSet but
// this only render text
void MODULE::TransformGraphicTextWithClearanceToPolygonSet(
PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError ) const
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( EDA_ITEM* item = GraphicalItemsList(); item != NULL; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text );
break;
}
case PCB_MODULE_EDGE_T:
// This function does not render this
break;
default:
break;
}
}
// Convert texts sur modules
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
prms.m_cornerBuffer = &aCornerBuffer;
for( unsigned ii = 0; ii < texts.size(); ii++ )
{
TEXTE_MODULE *textmod = texts[ii];
prms.m_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
prms.m_error = aError;
wxSize size = textmod->GetTextSize();
if( textmod->IsMirrored() )
size.x = -size.x;
DrawGraphicText( NULL, NULL, textmod->GetTextPos(), BLACK,
textmod->GetShownText(), textmod->GetDrawRotation(), size,
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly, &prms );
}
}