本文整理汇总了C++中NETINFO_ITEM::GetNetname方法的典型用法代码示例。如果您正苦于以下问题:C++ NETINFO_ITEM::GetNetname方法的具体用法?C++ NETINFO_ITEM::GetNetname怎么用?C++ NETINFO_ITEM::GetNetname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NETINFO_ITEM
的用法示例。
在下文中一共展示了NETINFO_ITEM::GetNetname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSignalsSection
/* Emit the netlist (which is actually the thing for which GenCAD is used these
* days!); tracks are handled later */
static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
{
wxString msg;
NETINFO_ITEM* net;
D_PAD* pad;
MODULE* module;
int NbNoConn = 1;
fputs( "$SIGNALS\n", aFile );
for( unsigned ii = 0; ii < aPcb->GetNetCount(); ii++ )
{
net = aPcb->FindNet( ii );
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
{
wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++;
}
if( net->GetNet() <= 0 ) // dummy netlist (no connection)
continue;
msg = wxT( "SIGNAL " ) + net->GetNetname();
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
for( module = aPcb->m_Modules; module; module = module->Next() )
{
for( pad = module->Pads(); pad; pad = pad->Next() )
{
wxString padname;
if( pad->GetNetCode() != net->GetNet() )
continue;
pad->StringPadName( padname );
msg.Printf( wxT( "NODE %s %s" ),
GetChars( module->GetReference() ),
GetChars( padname ) );
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
}
}
}
fputs( "$ENDSIGNALS\n\n", aFile );
}
示例2: GetSelectMenuText
wxString TRACK::GetSelectMenuText() const
{
wxString text;
wxString netname;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
// deleting tracks requires all the information we can get to
// disambiguate all the choices under the cursor!
if( board )
{
net = GetNet();
if( net )
netname = net->GetNetname();
else
netname = _("Not found");
}
else
{
wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) );
netname = wxT( "???" );
}
text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ),
GetChars( ShowWidth() ), GetChars( netname ),
GetNetCode(), GetChars( GetLayerName() ),
GetChars( ::LengthDoubleToString( GetLength() ) ) );
return text;
}
示例3: SetBoard
void WIDGET_NET_SELECTOR::SetBoard( BOARD* aBoard )
{
auto& netinfo = aBoard->GetNetInfo();
for( unsigned i = 1; i < netinfo.GetNetCount(); i++ )
{
NETINFO_ITEM* ni = netinfo.GetNetItem( i );
NET net;
net.m_Name = ni->GetNetname();
net.m_Code = i;
m_nets.push_back( net );
}
std::sort( m_nets.begin(), m_nets.end() );
// Add the list of selectable nets to the wxComboBox.
// Using a wxArrayString is much faster than adding each name separately
wxArrayString netnames;
netnames.Add( wxT( "<no net>" ) ); // Always on top of the list
for( auto& net : m_nets )
{
net.m_Pos = netnames.Add( net.m_Name );
}
Append( netnames );
}
示例4: GetMsgPanelInfoBase_Common
void TRACK::GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
// Display Net Name
if( GetBoard() )
{
NETINFO_ITEM* net = GetNet();
if( net )
msg = net->GetNetname();
else
msg = wxT( "<noname>" );
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
// Display net code : (useful in test or debug)
msg.Printf( wxT( "%d.%d" ), GetNetCode(), GetSubNet() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
}
#if defined(DEBUG)
// Display the flags
msg.Printf( wxT( "0x%08X" ), m_Flags );
aList.push_back( MSG_PANEL_ITEM( wxT( "Flags" ), msg, BLUE ) );
#if 0
// Display start and end pointers:
msg.Printf( wxT( "%p" ), start );
aList.push_back( MSG_PANEL_ITEM( wxT( "start ptr" ), msg, BLUE ) );
msg.Printf( wxT( "%p" ), end );
aList.push_back( MSG_PANEL_ITEM( wxT( "end ptr" ), msg, BLUE ) );
// Display this ptr
msg.Printf( wxT( "%p" ), this );
aList.push_back( MSG_PANEL_ITEM( wxT( "this" ), msg, BLUE ) );
#endif
#if 0
// Display start and end positions:
msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y );
aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg, BLUE ) );
msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y );
aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg, BLUE ) );
#endif
#endif // defined(DEBUG)
// Display the State member
msg = wxT( ". . " );
if( GetState( TRACK_LOCKED ) )
msg[0] = 'F';
if( GetState( TRACK_AR ) )
msg[2] = 'A';
aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
}
示例5: SetNetNameFromNetCode
bool ZONE_CONTAINER::SetNetNameFromNetCode( void )
{
NETINFO_ITEM* net;
if( m_Parent && ( net = ( (BOARD*) m_Parent )->FindNet( GetNet() ) ) )
{
m_Netname = net->GetNetname();
return true;
}
return false;
}
示例6: GetSelectMenuText
wxString ZONE_CONTAINER::GetSelectMenuText() const
{
wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
int ncont = m_Poly->GetContour( m_CornerSelection );
if( ncont )
text << wxT( " " ) << _( "(Cutout)" );
if( GetIsKeepout() )
text << wxT( " " ) << _( "(Keepout)" );
text << wxString::Format( wxT( " (%08lX)" ), m_TimeStamp );
// Display net name for copper zones
if( !GetIsKeepout() )
{
if( GetNetCode() >= 0 )
{
if( board )
{
net = GetNet();
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
}
else
{
text << _( "** NO BOARD DEFINED **" );
}
}
else
{ // A netcode < 0 is an error:
// Netname not found or area not initialised
text << wxT( " [" ) << GetNetname() << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
}
wxString msg;
msg.Printf( _( "Zone Outline %s on %s" ), GetChars( text ),
GetChars( GetLayerName() ) );
return msg;
}
示例7: build_via_testpoints
/* Extract the D356 record from the vias */
static void build_via_testpoints( BOARD *aPcb,
std::vector <D356_RECORD>& aRecords )
{
wxPoint origin = aPcb->GetAuxOrigin();
// Enumerate all the track segments and keep the vias
for( TRACK *track = aPcb->m_Track; track; track = track->Next() )
{
if( track->Type() == PCB_VIA_T )
{
VIA *via = (VIA*) track;
NETINFO_ITEM *net = track->GetNet();
D356_RECORD rk;
rk.smd = false;
rk.hole = true;
if( net )
rk.netname = net->GetNetname();
else
rk.netname = wxEmptyString;
rk.refdes = wxT("VIA");
rk.pin = wxT("");
rk.midpoint = true; // Vias are always midpoints
rk.drill = via->GetDrillValue();
rk.mechanical = false;
LAYER_ID top_layer, bottom_layer;
via->LayerPair( &top_layer, &bottom_layer );
rk.access = via_access_code( aPcb, top_layer, bottom_layer );
rk.x_location = via->GetPosition().x - origin.x;
rk.y_location = origin.y - via->GetPosition().y;
rk.x_size = via->GetWidth();
rk.y_size = 0; // Round so height = 0
rk.rotation = 0;
rk.soldermask = 3; // XXX always tented?
aRecords.push_back( rk );
}
}
}
示例8: SetNet
void ZONE_CONTAINER::SetNet( int aNetCode )
{
BOARD_CONNECTED_ITEM::SetNet( aNetCode );
if( aNetCode < 0 )
return;
BOARD* board = GetBoard();
if( board )
{
NETINFO_ITEM* net = board->FindNet( aNetCode );
if( net )
m_Netname = net->GetNetname();
else
m_Netname.Empty();
}
else
{
m_Netname.Empty();
}
}
示例9: buildAvailableListOfNets
void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
{
wxArrayString listNetName;
m_Parent->GetBoard()->ReturnSortedNetnamesList( listNetName, m_NetSortingByPadCount );
if( m_NetFiltering )
{
wxString doNotShowFilter = m_DoNotShowNetNameFilter->GetValue();
wxString ShowFilter = m_ShowNetNameFilter->GetValue();
for( unsigned ii = 0; ii < listNetName.GetCount(); ii++ )
{
if( listNetName[ii].Matches( doNotShowFilter ) )
{
listNetName.RemoveAt( ii );
ii--;
}
else if( !listNetName[ii].Matches( ShowFilter ) )
{
listNetName.RemoveAt( ii );
ii--;
}
}
}
listNetName.Insert( wxT( "<no net>" ), 0 );
// Ensure currently selected net for the zone is visible, regardless of filters
int selectedNetListNdx = -1;
int net_select = m_settings.m_NetcodeSelection;
if( net_select > 0 )
{
NETINFO_ITEM* equipot = m_Parent->GetBoard()->FindNet( net_select );
if( equipot )
{
selectedNetListNdx = listNetName.Index( equipot->GetNetname() );
if( wxNOT_FOUND == selectedNetListNdx )
{
// the currently selected net must *always* be visible.
listNetName.Insert( equipot->GetNetname(), 0 );
selectedNetListNdx = 0;
}
}
}
else if( net_select == 0 )
selectedNetListNdx = 0; // SetSelection() on "<no net>"
else
{
// selectedNetListNdx remains -1, no net selected.
}
m_ListNetNameSelection->Clear();
m_ListNetNameSelection->InsertItems( listNetName, 0 );
m_ListNetNameSelection->SetSelection( 0 );
if( selectedNetListNdx >= 0 )
{
m_ListNetNameSelection->SetSelection( selectedNetListNdx );
m_ListNetNameSelection->EnsureVisible( selectedNetListNdx );
}
}
示例10: importFile
bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
{
switch( (IO_MGR::PCB_FILE_T) aFileType )
{
case IO_MGR::EAGLE:
if( OpenProjectFiles( std::vector<wxString>( 1, aFileName ), KICTL_EAGLE_BRD ) )
{
wxString projectpath = Kiway().Prj().GetProjectPath();
wxFileName newfilename;
newfilename.SetPath( Prj().GetProjectPath() );
newfilename.SetName( Prj().GetProjectName() );
newfilename.SetExt( KiCadPcbFileExtension );
GetBoard()->SetFileName( newfilename.GetFullPath() );
UpdateTitle();
OnModify();
// Extract a footprint library from the design and add it to the fp-lib-table
wxString newLibPath;
ArchiveModulesOnBoard( true, newfilename.GetName(), &newLibPath );
if( newLibPath.Length() > 0 )
{
FP_LIB_TABLE* prjlibtable = Prj().PcbFootprintLibs();
const wxString& project_env = PROJECT_VAR_NAME;
wxString rel_path, env_path;
wxGetEnv( project_env, &env_path );
wxString result( newLibPath );
rel_path = result.Replace( env_path,
wxString( "$(" + project_env + ")" ) ) ? result : "" ;
if( !rel_path.IsEmpty() )
newLibPath = rel_path;
FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( newfilename.GetName(),
newLibPath, wxT( "KiCad" ), wxEmptyString );
prjlibtable->InsertRow( row );
}
if( !GetBoard()->GetFileName().IsEmpty() )
{
wxString tblName = Prj().FootprintLibTblName();
try
{
Prj().PcbFootprintLibs()->Save( tblName );
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Error occurred saving project specific footprint library "
"table:\n\n%s" ),
GetChars( ioe.What() ) );
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
}
}
// Update module LIB_IDs to point to the just imported Eagle library
for( MODULE* module : GetBoard()->Modules() )
{
LIB_ID libId = module->GetFPID();
if( libId.GetLibItemName().empty() )
continue;
libId.SetLibNickname( newfilename.GetName() );
module->SetFPID( libId );
}
// Store net names for all pads, to create net remap information
std::unordered_map<D_PAD*, wxString> netMap;
for( const auto& pad : GetBoard()->GetPads() )
{
NETINFO_ITEM* netinfo = pad->GetNet();
if( netinfo->GetNet() > 0 && !netinfo->GetNetname().IsEmpty() )
netMap[pad] = netinfo->GetNetname();
}
// Two stage netlist update:
// - first, assign valid timestamps to footprints (no reannotation)
// - second, perform schematic annotation and update footprint references
// based on timestamps
NETLIST netlist;
FetchNetlistFromSchematic( netlist, NO_ANNOTATION );
DoUpdatePCBFromNetlist( netlist, false );
FetchNetlistFromSchematic( netlist, QUIET_ANNOTATION );
DoUpdatePCBFromNetlist( netlist, true );
std::unordered_map<wxString, wxString> netRemap;
// Compare the old net names with the new net names and create a net map
for( const auto& pad : GetBoard()->GetPads() )
{
//.........这里部分代码省略.........
示例11: GetMsgPanelInfo
void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
msg = _( "Zone Outline" );
// Display Cutout instead of Outline for holes inside a zone
// i.e. when num contour !=0
int ncont = m_Poly->GetContour( m_CornerSelection );
if( ncont )
msg << wxT( " " ) << _( "(Cutout)" );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
if( GetIsKeepout() )
{
msg.Empty();
if( GetDoNotAllowVias() )
AccumulateDescription( msg, _("No via") );
if( GetDoNotAllowTracks() )
AccumulateDescription( msg, _("No track") );
if( GetDoNotAllowCopperPour() )
AccumulateDescription( msg, _("No copper pour") );
aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
}
else if( IsOnCopperLayer() )
{
if( GetNetCode() >= 0 )
{
NETINFO_ITEM* equipot = GetNet();
if( equipot )
msg = equipot->GetNetname();
else
msg = wxT( "<noname>" );
}
else // a netcode < 0 is an error
{
msg = wxT( " [" );
msg << GetNetname() + wxT( "]" );
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
#if 1
// Display net code : (useful in test or debug)
msg.Printf( wxT( "%d" ), GetNetCode() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
#endif
// Display priority level
msg.Printf( wxT( "%d" ), GetPriority() );
aList.push_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
}
else
{
aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
}
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );
if( m_FillMode )
msg = _( "Segments" );
else
msg = _( "Polygons" );
aList.push_back( MSG_PANEL_ITEM( _( "Fill mode" ), msg, BROWN ) );
// Useful for statistics :
msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() );
aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) );
if( m_FilledPolysList.GetCornersCount() )
{
msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) );
}
}
示例12: Solve
/* Route all traces
* :
* 1 if OK
* -1 if escape (stop being routed) request
* -2 if default memory allocation
*/
int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
{
int current_net_code;
int row_source, col_source, row_target, col_target;
int success, nbsucces = 0, nbunsucces = 0;
NETINFO_ITEM* net;
bool stop = false;
wxString msg;
int routedCount = 0; // routed ratsnest count
bool two_sides = aLayersCount == 2;
m_canvas->SetAbortRequest( false );
s_Clearance = GetBoard()->GetDesignSettings().GetDefault()->GetClearance();
// Prepare the undo command info
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
// go until no more work to do
GetWork( &row_source, &col_source, ¤t_net_code,
&row_target, &col_target, &pt_cur_ch ); // First net to route.
for( ; row_source != ILLEGAL; GetWork( &row_source, &col_source,
¤t_net_code, &row_target,
&col_target,
&pt_cur_ch ) )
{
// Test to stop routing ( escape key pressed )
wxYield();
if( m_canvas->GetAbortRequest() )
{
if( IsOK( this, _( "Abort routing?" ) ) )
{
success = STOP_FROM_ESC;
stop = true;
break;
}
else
{
m_canvas->SetAbortRequest( false );
}
}
EraseMsgBox();
routedCount++;
net = GetBoard()->FindNet( current_net_code );
if( net )
{
msg.Printf( wxT( "[%8.8s]" ), GetChars( net->GetNetname() ) );
AppendMsgPanel( wxT( "Net route" ), msg, BROWN );
msg.Printf( wxT( "%d / %d" ), routedCount, RoutingMatrix.m_RouteCount );
AppendMsgPanel( wxT( "Activity" ), msg, BROWN );
}
segm_oX = GetBoard()->GetBoundingBox().GetX() + (RoutingMatrix.m_GridRouting * col_source);
segm_oY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_source);
segm_fX = GetBoard()->GetBoundingBox().GetX() + (RoutingMatrix.m_GridRouting * col_target);
segm_fY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_target);
// Draw segment.
GRLine( m_canvas->GetClipBox(), DC,
segm_oX, segm_oY, segm_fX, segm_fY,
0, WHITE );
pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
success = Autoroute_One_Track( this, DC,
two_sides, row_source, col_source,
row_target, col_target, pt_cur_ch );
switch( success )
{
case NOSUCCESS:
pt_cur_ch->m_Status |= CH_UNROUTABLE;
nbunsucces++;
break;
case STOP_FROM_ESC:
stop = true;
break;
case ERR_MEMORY:
stop = true;
break;
default:
nbsucces++;
break;
}
msg.Printf( wxT( "%d" ), nbsucces );
//.........这里部分代码省略.........
示例13: Edit_Zone_Params
void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
{
ZONE_EDIT_T edited;
ZONE_SETTINGS zoneInfo = GetZoneSettings();
m_canvas->SetIgnoreMouseEvents( true );
// Save initial zones configuration, for undo/redo, before adding new zone
// note the net name and the layer can be changed, so we must save all zones
s_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList.ClearListAndDeleteItems();
SaveCopyOfZones(s_PickedList, GetBoard(), -1, -1 );
if( aZone->GetIsKeepout() )
{
// edit a keepout area on a copper layer
zoneInfo << *aZone;
edited = InvokeKeepoutAreaEditor( this, &zoneInfo );
}
else if( aZone->GetLayer() < FIRST_NO_COPPER_LAYER )
{
// edit a zone on a copper layer
zoneInfo << *aZone;
edited = InvokeCopperZonesEditor( this, &zoneInfo );
}
else
{
edited = InvokeNonCopperZonesEditor( this, aZone, &zoneInfo );
}
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
if( edited == ZONE_ABORT )
{
s_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList.ClearListAndDeleteItems();
return;
}
SetZoneSettings( zoneInfo );
if( edited == ZONE_EXPORT_VALUES )
{
UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
return;
}
// Undraw old zone outlines
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii );
edge_zone->Draw( m_canvas, DC, GR_XOR );
}
zoneInfo.ExportSetting( *aZone );
NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
if( net ) // net == NULL should not occur
aZone->SetNetName( net->GetNetname() );
// Combine zones if possible
GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone );
// Redraw the real new zone outlines
GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, -1 );
UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items
OnModify();
}
示例14: ListNetsAndSelect
void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
{
NETINFO_ITEM* net;
wxString netFilter;
wxArrayString list;
netFilter = wxT( "*" );
wxTextEntryDialog dlg( this, _( "Filter Net Names" ), _( "Net Filter" ), netFilter );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
netFilter = dlg.GetValue( );
if( netFilter.IsEmpty() )
return;
wxString Line;
for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ )
{
net = GetBoard()->m_NetInfo.GetNetItem( ii );
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
continue;
Line.Printf( wxT( "net %3.3d: %s" ), net->GetNet(),
GetChars( net->GetNetname() ) );
list.Add( Line );
}
wxSingleChoiceDialog choiceDlg( this, wxEmptyString, _( "Select Net" ), list );
if( (choiceDlg.ShowModal() == wxID_CANCEL) || (choiceDlg.GetSelection() == wxNOT_FOUND) )
return;
bool found = false;
unsigned netcode = (unsigned) choiceDlg.GetSelection();
// Search for the net selected.
for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ )
{
net = GetBoard()->FindNet( ii );
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
continue;
if( ii == netcode )
{
netcode = net->GetNet();
found = true;
break;
}
}
if( found )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
if( GetBoard()->IsHighLightNetON() )
HighLight( &dc );
GetBoard()->SetHighLightNet( netcode );
HighLight( &dc );
}
}
示例15: CreateRoutesSection
/* Creates the section ROUTES
* that handles tracks, vias
* TODO: add zones
* section:
* $ROUTE
* ...
* $ENROUTE
* Track segments must be sorted by nets
*/
static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
{
TRACK* track, ** tracklist;
int vianum = 1;
int old_netcode, old_width, old_layer;
int nbitems, ii;
LSET master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
int cu_count = aPcb->GetCopperLayerCount();
// Count items
nbitems = 0;
for( track = aPcb->m_Track; track; track = track->Next() )
nbitems++;
for( track = aPcb->m_Zone; track; track = track->Next() )
{
if( track->Type() == PCB_ZONE_T )
nbitems++;
}
tracklist = (TRACK**) operator new( (nbitems + 1)* sizeof( TRACK* ) );
nbitems = 0;
for( track = aPcb->m_Track; track; track = track->Next() )
tracklist[nbitems++] = track;
for( track = aPcb->m_Zone; track; track = track->Next() )
{
if( track->Type() == PCB_ZONE_T )
tracklist[nbitems++] = track;
}
tracklist[nbitems] = NULL;
qsort( tracklist, nbitems, sizeof(TRACK*), TrackListSortByNetcode );
fputs( "$ROUTES\n", aFile );
old_netcode = -1; old_width = -1; old_layer = -1;
for( ii = 0; ii < nbitems; ii++ )
{
track = tracklist[ii];
if( old_netcode != track->GetNetCode() )
{
old_netcode = track->GetNetCode();
NETINFO_ITEM* net = track->GetNet();
wxString netname;
if( net && (net->GetNetname() != wxEmptyString) )
netname = net->GetNetname();
else
netname = wxT( "_noname_" );
fprintf( aFile, "ROUTE %s\n", TO_UTF8( netname ) );
}
if( old_width != track->GetWidth() )
{
old_width = track->GetWidth();
fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() );
}
if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_ZONE_T) )
{
if( old_layer != track->GetLayer() )
{
old_layer = track->GetLayer();
fprintf( aFile, "LAYER %s\n",
GenCADLayerName( cu_count, track->GetLayer() ).c_str()
);
}
fprintf( aFile, "LINE %g %g %g %g\n",
MapXTo( track->GetStart().x ), MapYTo( track->GetStart().y ),
MapXTo( track->GetEnd().x ), MapYTo( track->GetEnd().y ) );
}
if( track->Type() == PCB_VIA_T )
{
const VIA* via = static_cast<const VIA*>(track);
LSET vset = via->GetLayerSet() & master_layermask;
fprintf( aFile, "VIA VIA%d.%d.%s %g %g ALL %g via%d\n",
via->GetWidth(), via->GetDrillValue(),
fmt_mask( vset ).c_str(),
//.........这里部分代码省略.........