本文整理汇总了C++中TRACK::GetSubNet方法的典型用法代码示例。如果您正苦于以下问题:C++ TRACK::GetSubNet方法的具体用法?C++ TRACK::GetSubNet怎么用?C++ TRACK::GetSubNet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRACK
的用法示例。
在下文中一共展示了TRACK::GetSubNet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildAirWiresTargetsList
/* Function BuildAirWiresTargetsList
* Build a list of candidates that can be a coonection point
* when a track is started.
* This functions prepares data to show airwires to nearest connecting points (pads)
* from the current new track to candidates during track creation
*/
void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
const wxPoint& aPosition, bool aInit )
{
if( ( ( m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|| ( ( m_Pcb->m_Status_Pcb & LISTE_PAD_OK ) == 0 )
|| ( ( m_Pcb->m_Status_Pcb & NET_CODES_OK ) == 0 ) )
{
s_TargetsLocations.clear();
return;
}
s_CursorPos = aPosition; // needed for sort_by_distance
if( aInit )
{
s_TargetsLocations.clear();
if( aItemRef == NULL )
return;
int net_code = aItemRef->GetNet();
int subnet = aItemRef->GetSubNet();
if( net_code <= 0 )
return;
NETINFO_ITEM* net = m_Pcb->FindNet( net_code );
if( net == NULL ) // Should not occur
{
wxMessageBox( wxT( "BuildAirWiresTargetsList() error: net not found" ) );
return;
}
// Create a list of pads candidates ( pads not already connected to the
// current track ):
for( unsigned ii = 0; ii < net->m_PadInNetList.size(); ii++ )
{
D_PAD* pad = net->m_PadInNetList[ii];
if( pad == aItemRef )
continue;
if( !pad->GetSubNet() || (pad->GetSubNet() != subnet) )
s_TargetsLocations.push_back( pad->GetPosition() );
}
// Create a list of tracks ends candidates, not already connected to the
// current track:
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->GetNet() < net_code )
continue;
if( track->GetNet() > net_code )
break;;
if( !track->GetSubNet() || (track->GetSubNet() != subnet) )
{
if( aPosition != track->GetStart() )
s_TargetsLocations.push_back( track->GetStart() );
if( aPosition != track->GetEnd() && track->GetStart() != track->GetEnd() )
s_TargetsLocations.push_back( track->GetEnd() );
}
}
// Remove duplicate targets, using the C++ unique algorithm
sort( s_TargetsLocations.begin(), s_TargetsLocations.end(), sort_by_point );
std::vector< wxPoint >::iterator it = unique( s_TargetsLocations.begin(), s_TargetsLocations.end() );
// Using the C++ unique algorithm only moves the duplicate entries to the end of
// of the array. This removes the duplicate entries from the array.
s_TargetsLocations.resize( it - s_TargetsLocations.begin() );
} // end if Init
// in all cases, sort by distances:
sort( s_TargetsLocations.begin(), s_TargetsLocations.end(), sort_by_distance );
}